ASP.NET Performance: Debugging W3WP Startup

ASP.NET Performance: Debugging W3WP Startup

Rate This
  • Comments 1

Editor note: This blog is originally published by Christy Henriksson on 03-19-2012 in Web Performance Blog, which will be obsolete soon.  Future ASP.NET related performance blogs will be posted here.

On a few occasions, I have needed to debug the startup of the IIS worker process (w3wp).  I finally decided to create a script so that I no longer need to search for the answer.  The script starts w3wp by requesting a non-existent ASPX page.  After windbg is closed, the script will kill the debug session and clean up the registry.

Script requirements:

Debug Script:

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\w3wp.exe" /v Debugger /t REG_SZ /d "cdb.exe -c \".server tcp:port=9999\"" /f
iisreset /restart
start /b tinyget5 -srv:localhost -uri:/notfound.aspx -status:404
sleep 3
windbg -remote tcp:port=9999,server=localhost
pskill cdb
pskill w3wp
reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\w3wp.exe" /f

UPDATE:

If you are setting managed breakpoints, you will want to break when the managed assembly loads using "sxe ld:Assembly".  For instance, "sxe ld:clr" or "sxe ld:System.Web.dll".

If you want to debug compilation, you should delete the "Temporary ASP.NET Files" under the framework installation folder for your website after the iisreset.

Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post
Page 1 of 1 (1 items)