locked
Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed. (Forbidden) RRS feed

  • Question

  • Hi,

    I have Windows Azure Mobile Service in running locally in IIS Express. Through emulator and from the desktop I can access the root url which is let's say http://169.254.32.215:59733/ which shows the message "This mobile service is up and running".

    Mobile Service is working perfectly when access through the desktop (POST/GET etc. working well). But not through the emulator? I have modified applicationhost.config adding the necessary binding.

    Ran iisexpress separately and ran my WP8 app, a post request was coming and then got blocked.

     

    Any ideas?


    Happy Coding. <br/> <br/> Regards, <br/> Jaliya Udagedara [MVP - Visual C#] | <a href="http://www.jaliyaudagedara.blogspot.com"> My Blog</a>

    Tuesday, February 25, 2014 11:20 AM

Answers

  •  

    You need to specify the application key of the service in the Web.config file:

    <add key="MS_MasterKey" value="Overriden by portal settings" />
    <add key="MS_ApplicationKey" value="Overriden by portal settings" />

    If you run the service within Visual Studio, you don't need these values, and every request will pass. When you deploy the service on Azure, these values are overriden with the correct values. But, if you deploy the Mobile Service on your local IIS, you need to manually set them, and be sure that they match the values you enter in the client. 

    You can also specify the Authorization Access Level for the Controller (or its methods). For example, if you want to allow Anonymous access:

    [Microsoft.WindowsAzure.Mobile.Service.Security.RequiresAuthorization(AuthorizationLevel.Anonymous)]
     public class TodoItemController : TableController<TodoItem>

    More info here: http://www.windowsazure.com/en-us/documentation/articles/mobile-services-dotnet-backend-windows-store-dotnet-get-started-users.


    Marco Minerva - MVP Visual C#
    Blog: http://marcominerva.wordpress.com
    Twitter: @marcominerva

    Thursday, February 27, 2014 8:38 AM

All replies

  • I am having the same problem. I tried to use local IIS instead and it did not help.

    Marcel

    Tuesday, February 25, 2014 3:53 PM
  • Dear Marcel,

    Same here, tried with Local IIS but didn't work.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MVP - Visual C#, MCPD, MCSD) | My Blog

    Tuesday, February 25, 2014 3:57 PM
  • Found something else. The Website is shown in my Windows Phone Emulator, but if I click on the 'Try it out' link on the 'normal' client it works not in the Windows Phone Emulator. There you get the same error as in the runtime.

    Have to investigate more on that one.

    Marcel

    Tuesday, February 25, 2014 4:14 PM
  • Dear Marcel,

    Again same here. From the desktop browser, I can do all the CRUD operations. In emulator, can go up the root URL. But not beyond that, HTTP 403 Forbidden.

    Sometimes, I just wonder whether it has anything to with our platform. I am running on Windows 8.1, Visual Studio 2013 and targeted .NET Framework is 4.5.1.

    I tried all day along, anyway let's keep trying and fix this out.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MVP - Visual C#, MCPD, MCSD) | My Blog

    Tuesday, February 25, 2014 4:53 PM
  •  

    You need to specify the application key of the service in the Web.config file:

    <add key="MS_MasterKey" value="Overriden by portal settings" />
    <add key="MS_ApplicationKey" value="Overriden by portal settings" />

    If you run the service within Visual Studio, you don't need these values, and every request will pass. When you deploy the service on Azure, these values are overriden with the correct values. But, if you deploy the Mobile Service on your local IIS, you need to manually set them, and be sure that they match the values you enter in the client. 

    You can also specify the Authorization Access Level for the Controller (or its methods). For example, if you want to allow Anonymous access:

    [Microsoft.WindowsAzure.Mobile.Service.Security.RequiresAuthorization(AuthorizationLevel.Anonymous)]
     public class TodoItemController : TableController<TodoItem>

    More info here: http://www.windowsazure.com/en-us/documentation/articles/mobile-services-dotnet-backend-windows-store-dotnet-get-started-users.


    Marco Minerva - MVP Visual C#
    Blog: http://marcominerva.wordpress.com
    Twitter: @marcominerva

    Thursday, February 27, 2014 8:38 AM
  • Dear Marco,

    Thanks. It solved my problem.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MVP - Visual C#, MCPD, MCSD) | My Blog

    Thursday, February 27, 2014 11:01 AM