MobileServiceInvalidOperationException RRS feed

  • Question

  • Hi, Ive been trying to run the todo xamarin sample project. I created a Xamarin native project and i've created a Xamarin.Forms mobile backend and I'm getting this error when i run the following code in the main activity of my project. I didn't change anything in the web app project except for the name of the connection string, which i doubt should do anything.

    Unhandled Exception:

    Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    [Activity(Label = "MainActivity", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity {

    //this is a placeholder uri public static MobileServiceClient MobileService = new MobileServiceClient(""); protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); CurrentPlatform.Init(); TodoItem item = new TodoItem { Id = Guid.NewGuid().ToString(), Text = "Awesome item", Complete = true }; await MobileService.GetTable<TodoItem>().InsertAsync(item); } }

        public class TodoItem
            public string Id { get; set; }
            [JsonProperty(PropertyName = "text")]
            public string Text { get; set; }
            [JsonProperty(PropertyName = "complete")]
            public bool Complete { get; set; }

    Any ideas? Is there something i need to change in the web config file of the web app (MobileApp_Runtime)?

    Tuesday, July 19, 2016 6:59 AM

All replies

  • An Invalid Operation is either a network error or a conflict.  You should definitely be capturing this within a try/catch block and handling it.

    There are a few things you can do:

    1) Verify your backend - turn on Diagnostic Logging and check the Log Stream to see if there are any errors

    2) Check the exception by setting a break point and inspecting it - there is more information than the exception than just the message.

    • Proposed as answer by Swikruti Bose Saturday, July 23, 2016 4:14 PM
    Tuesday, July 19, 2016 4:09 PM
  • If you're getting a 404, that probably means that you haven't deployed your server project, or it is missing the right controller. See,-my-app-isn't-working!

    Also, if you change the name of the connection string in the server project, it will definitely stop working. You need to have a database connection string named MS_TableConnectionString, or customize the server code to use a different connection string.

    Tuesday, July 19, 2016 7:40 PM