ASP.NET Performance: Debugging W3WP Startup

Xinyang Qiu

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 “HKLMSoftwareMicrosoftWindows NTCurrentVersionImage File Execution Optionsw3wp.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 “HKLMSoftwareMicrosoftWindows NTCurrentVersionImage File Execution Optionsw3wp.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.

0 comments

Discussion is closed.

Feedback usabilla icon