title: IIS worker process (w3wp.exe) shoots to 99% CPU when WCF service is invoked
body: <p>We have a .NET 3.5 WCF service hosted on IIS 6.0 which has a basicHttp binding. This is consumed by 2 .NET and 2 ASP applications. When the 4th application (irrespective of .NET or ASP) is started and tries consuming it, the w3wp.exe peaks at 99% and stays there after few seconds. </p>
  
  <p>Based on this <a href="http://blogs.msdn.com/b/wenlong/archive/2008/04/21/wcf-request-throttling-and-server-scalability.aspx" rel="nofollow">article</a>, we tried adding the following to the .NET 2.0 machine.config but this does not have any effect.</p>
  
  <pre><code>&lt;processModel autoConfig="false" maxWorkerThreads="500" maxIoThreads="500" minWorkerThreads="2"/&gt;
  &lt;httpRuntime minFreeThreads="250" minLocalRequestFreeThreads="250"/&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT: Added the crash analysis report info:</p>
  
  <p>Warning 1: The following threads in w3wp.exe_<em>v2.0 Applications</em>_PID_<em>2856</em>_Date__12_08_2011__Time_12_13_39PM_<em>876</em>_Manual Dump.dmp are waiting on a synchronous WCF request to execute
  4.35% of threads blocked</p>
  
  <p>Please click on the Actual Thread to see the desnitation WCF Thread or check WCF Request report to find out the thread id for the actual WCF thread for which this thread is waiting on. For more details on this WCF Behavior check out the blog on WCF Request Throttling and Server Scalability.</p>
  
  <pre><code>Thread 16 - System ID 3920
  Entry point   mscorwks!ThreadpoolMgr::intermediateThreadProc 
  Create time   12/8/2011 12:10:44 PM 
  Time spent in user mode   0 Days 00:00:00.031 
  Time spent in kernel mode   0 Days 00:00:00.140 
  
  This thread is waiting on a synchronous WCF request to execute
  
  The destination WCF Thread for this ASP.NET worker thread is 14
  
  
  .NET Call Stack
  Function 
  System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32, Boolean, Boolean) 
  System.Threading.WaitHandle.WaitOne(Int64, Boolean) 
  System.Threading.WaitHandle.WaitOne(Int32, Boolean) 
  System.Threading.WaitHandle.WaitOne() 
  System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(System.Web.HttpApplication, Boolean) 
  System.ServiceModel.Activation.HttpModule.ProcessRequest(System.Object, System.EventArgs) 
  System.Web.HttpApplication+SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
  System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef) 
  System.Web.HttpApplication+ApplicationStepManager.ResumeSteps(System.Exception) 
  System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object) 
  System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest) 
  System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest) 
  System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr, Int32) 
  </code></pre>