4
votes

I have added a vanilla mobile service, selecting the defaults all the way. It is a .Net backend, using a new 20MB DB on an existing server I use in the North Europe DC. I created a blank Windows Store App, added the MobileServices nuget package and then followed the instructions to connect my MobileService to my app by adding the MobileServicesClient to my App.xaml class. Then I added a button with an event handler. The handler calls an async function to insert a TodoItem object into the database.

App.xaml.cs

public static MobileServiceClient MobileService = new MobileServiceClient(
             "https://???.azure-mobile.net/",
             "???");

I have replaced the URI and Token with ???. The one I used came from my Azure Portal for this Mobile Service.

MainPage.xaml.cs

private void Button_Click(object sender, RoutedEventArgs e)
{
    CreateItem();
}

private async  void CreateItem()
{
    TodoItem item = new TodoItem { Text = "Sort This", Complete = false };
    try
    {
        await App.MobileService.GetTable<TodoItem>().InsertAsync(item);
    }
    catch(MobileServiceInvalidOperationException ex1)
    {
        Debug.WriteLine(ex1.Message);
    }
    catch(Exception ex)
    {
        Debug.WriteLine(ex.Message);
    }
}

When I run this code and click the button a MobileServiceInvalidOperationException is raised:

"{"The request could not be completed. (Not Found)"}"

I am using VS2013, with Service Pack 2 installed and WindowsAzure.MobileServices 1.2.3.

The MobileService is running as I can navigate to https://MyMobileService.azure-mobile.net/ but, if I click Check It Out, I am asked to Authenticate (MyMobileService is not the actual Uri).

The post request looks ok, but the response is a 404.

I have been working on this all day, including using Windows Phone, with no luck...

I know I must be doing something wrong, or there is an issue with Azure in Northern Europe, but I can't sort it out.

Any help much appreciated.

Jason.

1
To authenticate via the try it out link, use your application or master key as the password and leave the user field blank. Then see if the post works from there. That will help trace the issue to the server vs client.phillipv
I got this error too. I'm not sure what exactly fixed it, but I did the following (with .NET backend): 1) Disable firewall. 2) Deploy the service project of the solution to AMS. 3) Uncomment the MobileServiceClient constructor with the actual URL, and comment the constructor with the localhost URL.Paul

1 Answers

4
votes

I had the same issue awhile ago. I switch from .net backend to javascript. Also, make sure your mobileservice and db schema match.