Question

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.

Was it helpful?

Solution

Are you using Azure Storage Nuget version 3.0.3.0 or do you happen to have a different version? We have some problems at the moment dealing with NuGet packages that are newer than the versions we use in the cloud. If you don't have 3.0.3.0 then could you please try that instead?

Henrik

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top