Attention: We are retiring the IIS.NET Community Blogs. Learn more >

ASP.net Hang in IIS 7.0

When hosting an ASP.net web application on IIS7, and you have the application running in integrated pipeline mode, you may find that users complain that the application performs slowly.  This may occur if your website is busy, handling 12 or more requests concurrently, and those requests are handled asynchronously as opposed to synchronously.  The same application may appear to not suffer from poor performance when hosted on an IIS 6.0 server, or if the IIS7 site is set to run in Classic mode. 

 

If you were to look at the currently executing requests in the IIS Manager by using the Request Monitor feature, you may see 12 requests currently in the ExecuteRequestHandler state, and all of the other requests waiting in the BeginRequest state:

 

 

The behaviour occurs because beginning in IIS7, when an ASP.net application runs in Integrated mode there is a restriction on the number of concurrently executing requests per CPU.  By default, the limit to the number of concurrently executing ASP.net requests is 12.  You can modify this limit by setting the MaxConcurrentRequestsPerCPU registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727 to a value higher than 12.  NOTE: By default, this registry key does not exist.  You will need to create it manually as a DWORD and give it a value.  The value you should give it depends on your application load and how many concurrent requests are expected. 

 

 

For a more detailed explanation of how ASP.net threading works in IIS6 and IIS7, please see:

 

ASP.NET Thread Usage on IIS 7.0 and 6.0

http://blogs.msdn.com/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx

 

AND

 

Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications

http://support.microsoft.com/kb/821268

No Comments