asp.netasp.net-mvc-2ihttphandlerihttpasynchandler

Why is IHttpAsyncHandler being called over IHttpHandler?


I made a custom handler that derives from MvcHandler. I have my routes using a custom RouteHandler that returns my new handler for GetHttpHandler(), and I override ProcessRequest() in my custom handler. The call to GetHttpHandler is triggering a breakpoint and my handler's constructor is definitely being called, but BeginProcessRequest() is being called on the base MvcHandler instead of ProcessRequest().

Why are the async methods being called when I haven't done anything to call them? I don't want asynchronous handling, and I certainly didn't do anything explicit to get it. My controllers all derive from Controller, not AsyncController.

I don't have the source code with me right now, but I can add it later if needed. I was hoping someone might know some of the reasons why BeginProcessRequest might be called when it's not wanted.


Solution

  • Brad Wilson responded to my post on the Asp.net forums with the following answer http://forums.asp.net/t/1547898.aspx:

    Short answer: yes.

    With the addition of AsyncController, the MvcHandler class needs to be an IHttpAsyncHandler now, which means that as far as the ASP.NET core runtime is concerned, the entry points are now BeginProcessRequest and EndProcessRequest, not ProcessRequest.

    It sounds like ProcessRequest is not even called anymore, but I could be mistaken. I can say that I haven't seen it in my testing.