Custom API Routing Issue with Azure Mobile Apps .NET Backend

After migrating from Azure MobileService to Azure Mobile App Service, my custom API endpoint now returns a 404 error. How can I correctly set up routing? See example code:

[ApiMobile]
public class CustomApiController : ApiController {
    [Route("api/custom/handle")]
    [HttpPost]
    public async Task<IHttpActionResult> HandleRequest(string inputData) {
        return Ok(inputData + " processed");
    }
}

hey, try adding [routePrefix(‘api/custom’)] on ur controller and adjust the method route to ‘handle’. sometimes azure’s routing gets funky if u dont set the proper prefix. check web.config settings too if this still doesnt work

It appears that the issue could be related to configuration settings rather than the route attributes in your controller. In a similar migration, I encountered a scenario where enabling attribute routing in the WebApiConfig file was necessary for custom APIs to work as expected. I ensured that the configuration for the Mobile App Service matched the new requirements and verified that the expected HTTP verb and parameter binding were correctly processed. Revisiting the Mobile App Service setup and checking device logs often reveals subtle misconfigurations that resolve the issue.

hey, im wonderin if you’ve setup your startup.cs right? azure mobile services sometimes needs explicit route mapping which might be missing. did u already try experimenting with modifying your config? would love to hear wat worked for others