问题
I've just upgraded an ASP.NET Core 1.1 web application to 2.0 and tested without issue locally. However, when the site is deployed to Azure a POST request that worked locally results in a 404 (I guess this could be the same for all POST requests, but I'm unable to log-in due to the issue).
Any ideas why this might fail to be working when deployed to Azure but working perfectly when run through IIS Express locally?
I deleted the original deployment slot on Azure and re-created as initially deploying over the slot mixed old 1.1 DLL's with the newer 2.0 DLL's and prevented the site working at all.
回答1:
Seems I was caught out by poor handling of errors by my web application. I'd assumed that app.UseExceptionHandler("/Error")
(I default my HomeController to not require the leading "Home" for /Home/Error) in Startup.cs
would redirect to an error page, but for me it is not.
My underlying issue was a database connection error that caused the POST controller method to fail. I was caught out by the response returning a 404 rather than an error status.
I will need to investigate how error handling works in more detail for ASP.NET Core it seems.
来源:https://stackoverflow.com/questions/46272315/asp-net-core-2-0-site-post-request-resulting-in-404-on-azure