I have made a mobile service (based on this "http://wp.sjkp.dk/azure-mobile-service-net-backend-using-azure-table-storage/"). It works perfectly on my local machine, but when i deploy it to the cloud it gives a 500 "internal server error", more precisely I get this exception:
Error Exception=System.TypeLoadException: GenericArguments[0], 'ModelLibrary.MenuEntity', on 'Microsoft.WindowsAzure.Mobile.Service.StorageDomainManager`1[TData]' violates the constraint of type parameter 'TData'. at lunchviewerService.Controllers.MenuController.Initialize(HttpControllerContext controllerContext) at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__0.MoveNext(), Id=eda6ebbf-e30f-4a03-a60a-28e9ed92a6ee, Category='App.Request' App.Request 09-05-2014 10:09:48
I understand the error, but the class MenuEntity does implement the interfaces which the StorageDomainManager has as generic constraints.
The offending code looks as follows:
public class MenuController : TableController<MenuEntity> { protected override void Initialize(HttpControllerContext controllerContext) { base.Initialize(controllerContext); DomainManager = new StorageDomainManager<MenuEntity>("StorageConnectionString", "Menus", Request, Services); }
I have tried everything I know, and searched exhaustively on google... However no luck there.