Hi @SKR,
Thank you for reaching us regarding the issue and very common issue when moving an ASP.NET Web API from local development (IIS Express) to Azure App Service. Your app works fine on localhost because IIS Express typically doesn't have WebDAV active or interfering, but Azure runs on full IIS where WebDAV is enabled by default and can block or conflict with certain HTTP verbs, including POST in some setup scenarios.
This is usually fixed with a small web.config adjustment, no portal settings or code changes needed beyond that.
Recommendation:
Add or update the following in your project's root web.config file under the section:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers accessPolicy="Read, Script">
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0"
path="*."
verb="GET,HAD,POST,PUT,DELETE,PATCH,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
- This removes the WebDAV module/handler (the main culprit) and reconfigures the extensionless handler to explicitly support the verbs your API uses in Azure's Integrated pipeline mode.
- Redeploy your app (e.g., via VS Code's Azure extension, Azure DevOps, or ZIP deploy).
- After deployment, go to the Azure Portal > Your App Service > Overview > Restart to ensure the config is picked up.
After Deploy, Quick Test :
- Use Postman or curl: POST https://yourapp.azurewebsites.net/api/yourendpoint (with any required body/headers like Content-Type: application/json).
- If you still see 405, inspect the response headers, the Allow header will list what methods IIS currently permits (super helpful for debugging).
Additional Tips:
- Confirm your controller uses [HttpPost] and the route matches perfectly (no extra/trailing slashes).
- If this is an ASP.NET Core app (no web.config handlers needed), focus on routing in Program.cs/Startup.cs and CORS if cross-origin.
- For more visibility: Portal > Monitoring > Log stream or enable Application logging / Failed request tracing in Diagnostic settings.
Reference:
https://learn.microsoft.com/en-us/aspnet/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications#what-causes-http-405-errors
https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/site-behavior-performance/http-error-405-website
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
Kindly let us know if the above helps or you need further assistance on this issue.
Please "accept" if the information helped you. This will help us and others in the community as well.