I am new azure mobile service and ASP.NET MVC and have successfully created a mobile service and published it. It works fine.
My issue is how do I consume it in ASP.NET MVC application?
I created an ASP.NET MVC application from scratch, added the following nuget WindowsAzure.MobileService.
Happy days no issues.
In my controller I have
public static MobileServiceClient MobileService = new MobileServiceClient("http://localhost:50270/");
var list = await MobileService.InvokeApiAsync<IEnumerable<xxxx>>("xxxxxx",System.Net.Http.HttpMethod.Get, null);
When I run the website, it breaks with the following error. For some reason it does not like the @Html (Razor syntax)
Compiler Error Message: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Source Error:
Line 18: <span class="icon-bar"></span>
Line 19: </button>
Line 20:--->Error @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
Line 21: </div>
Line 22: <div class="navbar-collapse collapse">
If I get rid of "WindowsAzure.MobileService" package it works fine.
What am I doing wrong here? Am I missing something?
Also is this the right way to consume Mobile Service in ASP.NET?