ASP.NET Core 2.0 site POST request resulting in 404 on Azure

风流意气都作罢 提交于 2019-12-10 20:56:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!