ASP.NET Web Api. Controller not hit. No response a

2019-07-23 06:31发布

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

2条回答
劫难
2楼-- · 2019-07-23 06:51

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

查看更多
冷血范
3楼-- · 2019-07-23 07:14

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.

查看更多
登录 后发表回答