How to debug: w3wp.exe process was terminated due to a stack overflow (works on one machine but not another) How to debug: w3wp.exe process was terminated due to a stack overflow (works on one machine but not another) asp.net asp.net

How to debug: w3wp.exe process was terminated due to a stack overflow (works on one machine but not another)


This question is a bit old, but I just found a nice way of getting the stack trace of my application just before overflowing and I would like share it with other googlers out there:

  1. When your ASP.NET app crashes, a set of debugging files are dumped in a "crash folder" inside this main folder:

    C:\ProgramData\Microsoft\Windows\WER\ReportQueue

  2. These files can be analysed using WinDbg, which you can download from one of the links below:

  3. After installing it in the same machine where your app crashed, click File > Open Crash Dump and select the largest .tmp file in your "crash folder" (mine had 180 MB). Something like:

    AppCrash_w3wp.exe_3d6ded0d29abf2144c567e08f6b23316ff3a7_cab_849897b9\WER688D.tmp

  4. Then, run the following commands in the command window that just opened:

    .loadby sos clr!clrstack
  5. Finally, the generated output will contain your app stack trace just before overflowing, and you can easily track down what caused the overflow. In my case it was a buggy logging method:

    000000dea63aed30 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception)000000dea63aedd0 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception)000000dea63aee70 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception)000000dea63aef10 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception)000000dea63aefb0 000007fd88de9d00 Library.Logging.RepositoryLogger.Error(System.Object, System.Exception)000000dea63af040 000007fd88de9ba0 Library.WebServices.ErrorLogger.ProvideFault(System.Exception, System.ServiceModel.Channels.MessageVersion, System.ServiceModel.Channels.Message ByRef)

Thanks to Paul White and his blog post: Debugging Faulting Application w3wp.exe Crashes


A default stack limit for w3wp.exe is a joke. I always raise it with editbin /stack:9000000 w3wp.exe, it should be sufficient. Get rid of your stack overflow first, and then debug whatever you want.


Get a crash dump, run it against Microsoft's Debug Diagnostic Tool and show us the result.

Also take a look at http://support.microsoft.com/kb/919789/en-us, which explains all the necessary steps in detail.