开发者

In IIS7, what happens between Application_BeginRequest and Application_PreRequestHandlerExecute?

I've got some tracing statements with timestamps on an ASP.Net IIS application that gets a lot of traffic. I开发者_运维百科've got trace statements at the end of Application_BeginRequest and the beginning of Application_PreRequestHandlerExecute in my Global.asax. Occasionally there is a big delay between the end of BeginRequest and the start of PreRequestHandlerExecute, i.e. more than 5 seconds.

What is going on in the lifecycle of an HttpRequest between these two method calls that could be taking so long? This is IIS7 on Windows Server 2008.

Thanks.


If BeginRequest has already happend and the delay is before PreRequestHandlerExecute, you might want to log the thread id. If it is different, you suffer from ASP.NET thread agility.

A reason for this to happen can be the use of sessions. ASP.NET uses a reader-writer lock on the HttpContext.Current.Session. If you write to this variable, all the other request with the same session cannot run concurrently and are parked in a queue. .NET uses a polling mechanism to check whether the session lock is released.

I would also recommend checken that you've build on Release and that system.web/compilation/@debug = 'false'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜