ASP.NET Web Api. Controller not hit. No response at all. Approaches to diagnose?

ぃ、小莉子 提交于 2020-01-15 09:10:11

问题


I have a controller method which was previously working and it's not clear what change, if any, has caused the following problem:

The controller is not hit. There is no exception, no response, no status code or indeed any response from the server (checked in Fiddler). The request eventually times out.

UPDATE

See my answer below. Also see my follow up question:

Web API Controller method executes to end. No HTTP response. Hangs


回答1:


Is your project under source control? You mention that it was previously working. If you're under source control you may be able to rollback changes to your controller, test and isolate the change that caused the problem.

Another thing to check would be changes to routing. Perhaps your controller hasn't changed, but something with routing did. Routing can be tricky, there are some tools to help. A quick Google search came up with this:

https://blogs.msdn.microsoft.com/webdev/2013/04/04/debugging-asp-net-web-api-with-route-debugger/

I haven't used it myself, but I may in the future as I've run into routing problems before.




回答2:


This problem appears to be an artefact of the actual problem; which appears to be that the browser/middleware/web-app are queuing the requests and previous hung requests are causing the behaviour described eventually noticed to be 'waiting for available socket...')

What happens in a clean room situation is slightly different (the controller method executes to the end and returns a result, however there is no HTTP response) and warrants a new question, see Web API Controller method executes to end. No HTTP response. Hangs



来源:https://stackoverflow.com/questions/41447917/asp-net-web-api-controller-not-hit-no-response-at-all-approaches-to-diagnose

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