Resolve the "HTTP 404" error when calling a Azure Mobile App Service custom API (.NET backend)
I got the "HTTP 404 - method not found" error message when calling a a Azure Mobile App custom API (.NET backend) from the Universal Windows App (UWP). The custom API is defined as following:
// GET api/GetStorageToken
[HttpGet, Route("api/GetStorageToken/{contName}")]
public async Task<StorageTokenViewModel> GetStorageToken(string containerName)
{
.....
}
I verified this issue and compared with the existing custom API which can be called successfully, and I found out the issue was the parameter name in the custom API different from the line above " [HttpGet, Route("api/GetStorageToken/{contName}")]", once I updated it to [HttpGet, Route("api/GetStorageToken/{containerName}")], I can call this API successfully.
// GET api/GetStorageToken
[HttpGet, Route("api/GetStorageToken/{contName}")]
public async Task<StorageTokenViewModel> GetStorageToken(string containerName)
{
.....
}
I verified this issue and compared with the existing custom API which can be called successfully, and I found out the issue was the parameter name in the custom API different from the line above " [HttpGet, Route("api/GetStorageToken/{contName}")]", once I updated it to [HttpGet, Route("api/GetStorageToken/{containerName}")], I can call this API successfully.
The post is written in very a good manner and it contains much useful information.
ReplyDeleteMobile App Development Sydney
Thx, let me know if you have any suggestions.
Delete