locked
Azure Mobile Apps Custom API .Net backend RRS feed

  • Question

  • I have had a MobileService running on Azure, and have decided to create a new service and migrate the code myself. The new service is of the new type called: Azure Mobile App Service.

    Currently I have Authentication working, and can do migrations/update-database. I am following the TodoItem example. I now want to create my own Custom API, which easily worked on MobileService, but I cannot get it working on Azure Mobile App :/

    I have followed these two links web-Api-routing and app-service-mobile-backend. And I now have the following:

    I have created a new controller:


    [MobileAppController]
    public class TestController : ApiController
    {
        // GET api/Test
        [Route("api/Test/completeAll")]
        [HttpPost]
        public async Task<ihttpactionresult> completeAll(string info)
        {
            return Ok(info + info + info);
        }
    }

    In the mobileApp.cs I have added the below code according to backend:

    HttpConfiguration config = new HttpConfiguration();
    config.MapHttpAttributeRoutes();

    Additionally I have installed the below package according to web-api-routing:

    Microsoft.AspNet.WebApi.WebHost 

    and the call from the client:

    string t = await App.MobileService.InvokeApiAsync<string,string>("Test/completeAll", "hej");
    Debug shows, that it is the correct URL:

    {Method: POST, RequestUri: 'https://xxxxxxx.azurewebsites.net/api/Test/completeAll', Version: 1.1, Content: System.Net.Http.StringContent, Headers:{ X-ZUMO-FEATURES: AT X-ZUMO-INSTALLATION-ID: e9b359df-d15e-4119-a4ad-afe3031d8cd5 X-ZUMO-AUTH: xxxxxxxxxxx Accept: application/json User-Agent: ZUMO/2.0 User-Agent: (lang=Managed; os=Windows Store; os_version=--; arch=Neutral; version=2.0.31125.0) X-ZUMO-VERSION: ZUMO/2.0 (lang=Managed; os=Windows Store; os_version=--; arch=Neutral; version=2.0.31125.0) ZUMO-API-VERSION: 2.0.0 Content-Type: application/json; charset=utf-8 Content-Length: 3}}

    But keep getting: 404 (Not Found) Debug Message "The request could not be completed. (Not Found)"

    What am I missing :/ ?

    Update

    I have tried expanding the code in The mobileApp.cs, with:

    HttpConfiguration config = new HttpConfiguration();
            new MobileAppConfiguration()
                .UseDefaultConfiguration().MapApiControllers()
                .ApplyTo(config);
            config.MapHttpAttributeRoutes();
            app.UseWebApi(config);
    based on app-service-backend, however still no access :/

    Update

    I used fiddler2 to access the endpoint through a browser and got the following results:


    http://i.stack.imgur.com/gk6IH.png

    Update Again

    I have tried to create another minimal solution, but still get the same error. Are there any great tutorials that I can follow to achieve this functionality?

    Additional Information

    The  PC is running win10, the server nuget (nuget.org/packages/Microsoft.Azure.Mobile.Server ) package is updated to the newest: 1.1.157.1. (there are no updates for any package on my system). I have rebuiled checked, "Remove additional files at destination." and republished. . . . The same error persist (404), no better response using fiddler. Are there a minimal solution that you know works, I can get? So I only need to change the connection strings?

    I have also have the question running on StackOverflow
    with minimal engagement. Hope for some help.


    • Edited by JOTM123 Tuesday, March 8, 2016 9:17 AM all info
    • Moved by Azam Khan - MSFT Tuesday, March 8, 2016 5:08 PM right forum
    Tuesday, March 8, 2016 9:16 AM

Answers

  • Solved on Stackoverflow http://stackoverflow.com/questions/35717996/azure-custom-controller-api-net-backend
    • Marked as answer by JOTM123 Wednesday, April 6, 2016 7:15 AM
    Wednesday, April 6, 2016 7:15 AM

All replies

  •  Hi,

    Greetings

    Thank you for reaching out to us. I am currently researching to gather more information with regards to your request. I shall revert back to you with an update at the earliest. Sincerely appreciate your patience.

    Regards,

    Asha

    Wednesday, March 9, 2016 5:09 AM
  • Any news to the issue ? This has forced me to keep adding new features to MobileService, prolonging the later migration.

    Do I really need to open a support ticket for this issue?
    Friday, March 11, 2016 8:55 AM
  • Hi,
    Sorry for delay in Response
    I would request you to open a Support ticket with us,So the team will provide you more insight on the issue.

    https://azure.microsoft.com/en-in/support/options/

    Regards,
    Asha

    Monday, March 14, 2016 2:56 AM
  • Did you try setting MS_SkipVersionCheck to true in the app setting to opt out of version checking. You can specify this either in your web.config or in the Application Settings section of the Azure Portal.

    let me know if that helps.


    Rami Sarieddine Technical Evangelist

    Wednesday, March 16, 2016 8:57 AM
  • I have now read a bit about it here: https://azure.microsoft.com/da-dk/documentation/articles/app-service-mobile-client-and-server-versioning/

    And I do not think it applies. But I added it to portal. But keep getting not found
    Wednesday, March 16, 2016 7:57 PM
  • Solved on Stackoverflow http://stackoverflow.com/questions/35717996/azure-custom-controller-api-net-backend
    • Marked as answer by JOTM123 Wednesday, April 6, 2016 7:15 AM
    Wednesday, April 6, 2016 7:15 AM