views:

427

answers:

1

Hello All,

I am running an ASP.NET application with a custom module registered under IIS7.

Until two days back, everything was running fine. Now I notice that the requests started to hang at the AuthenticateRequest state and in the WindowsAuthentication module. My custom module intercepts at the BeginRequest state and processes the requests and completes the request processing using HttpContext.Current.ApplicationInstance.CompleteRequest(). The requests that it doesn't process are left for IIS to take them through the other modules for processing.

The problem (the request hang) occurs in pages that my custom module doesn't process.

Any ideas where I should start troubleshooting this problem? I have consistently reproduced this problem on three different machines today. I also found that we did not change our web.config file in the last month.

Any help towards troubleshooting this problem is greatly appreciated.

Thanks in advance, Charles Prakash Dasari

A: 

Finally I found the solution to my problem.

The custom module I have implemented uses async handlers:

        context.AddOnBeginRequestAsync(
            new BeginEventHandler(BeginBeginRequest),
            new EndEventHandler(EndBeginRequest)
        );

In the case where my module do not process the request, the begin event handler completes the request and has nothing to do in it. Up until a couple of days ago, I was jumping off to another thread to process these requests in the Begin method and recently I fixed it such a way that I jump off to another thread only if my module has to process the request. Now this has caused the problem. Apparently IIS is not liking that I am completing my processing in the same thread.

So now I jump off to another thread again - no matter what. IIS is happy and my app is not hanging any more.

I still have to investigate further and make sure why this happens - or if it is a bug really in IIS or in the way I return the IAsyncResult from BeginBeginRequest method. But for now I know that I have to process this request on a different thread.

Charles Prakash Dasari