{"id":974,"date":"2013-11-15T08:06:00","date_gmt":"2013-11-15T08:06:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2013\/11\/15\/asp-net-performance-debugging-w3wp-startup\/"},"modified":"2013-11-15T08:06:00","modified_gmt":"2013-11-15T08:06:00","slug":"asp-net-performance-debugging-w3wp-startup","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/asp-net-performance-debugging-w3wp-startup\/","title":{"rendered":"ASP.NET Performance: Debugging W3WP Startup"},"content":{"rendered":"<p><em>Editor note: This blog is originally published by <\/em><a href=\"http:\/\/blogs.msdn.com\/62768\/ProfileUrlRedirect.ashx\">Christy Henriksson<\/a><em> on 03-19-2012 in <\/em><a href=\"http:\/\/blogs.msdn.com\/b\/web_performance_blog\/\"><em>Web Performance Blog<\/em><\/a><em>, which will be obsolete soon.&nbsp; Future ASP.NET related performance blogs will be posted here.<\/em><\/p>\n<p>On a few occasions, I have needed to debug the startup of the IIS worker process (w3wp).&nbsp; I finally decided to create a script so that I no longer need to search for <a href=\"http:\/\/blogs.technet.com\/b\/marcelofartura\/archive\/2007\/08\/09\/how-to-attach-a-debugger-from-the-creation-time-of-the-worker-process-w3wp-exe.aspx\">the answer<\/a>.&nbsp; The script starts w3wp by requesting a non-existent ASPX page.&nbsp; After windbg is closed, the script will kill the debug session and clean up the registry.<\/p>\n<p><strong>Script requirements:<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/windows\/hardware\/gg463009\">Debugging Tools for Windows<\/a><\/li>\n<li>TinyGet, from the <a href=\"http:\/\/www.microsoft.com\/download\/en\/details.aspx?displaylang=en&amp;id=17275\">IIS Resource Kit Tools<\/a><\/li>\n<li>PsKill from <a href=\"http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896649\">PsTools<\/a><\/li>\n<\/ul>\n<p><strong>Debug Script:<\/strong><\/p>\n<p><span style=\"font-family: courier new\">reg add &#8220;HKLMSoftwareMicrosoftWindows NTCurrentVersionImage File Execution Optionsw3wp.exe&#8221; \/v Debugger \/t REG_SZ \/d &#8220;cdb.exe -c &#8220;.server tcp:port=9999&#8243;&#8221; \/f <br>iisreset \/restart <br>start \/b tinyget5 -srv:localhost -uri:\/notfound.aspx -status:404 <br>sleep 3 <br>windbg -remote tcp:port=9999,server=localhost <br>pskill cdb <br>pskill w3wp <br>reg delete &#8220;HKLMSoftwareMicrosoftWindows NTCurrentVersionImage File Execution Optionsw3wp.exe&#8221; \/f<\/span><\/p>\n<p><span style=\"font-family: arial,helvetica,sans-serif\"><strong>UPDATE:<\/strong><\/span><\/p>\n<p><span style=\"font-family: arial,helvetica,sans-serif\">If you are setting managed breakpoints, you will want to break when the managed assembly loads using &#8220;sxe ld:Assembly&#8221;.&nbsp; For instance, &#8220;sxe ld:clr&#8221; or &#8220;sxe ld:System.Web.dll&#8221;.<\/span><\/p>\n<p><span style=\"font-family: arial,helvetica,sans-serif\">If you want to <\/span><span style=\"font-family: arial,helvetica,sans-serif\">debug compilation, you should delete the &#8220;Temporary ASP.NET Files&#8221; under the framework installation folder for your website after the iisreset.<\/span><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Editor note: This blog is originally published by Christy Henriksson on 03-19-2012 in Web Performance Blog, which will be obsolete soon.&nbsp; 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).&nbsp; I finally decided to create a script so [&hellip;]<\/p>\n","protected":false},"author":410,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[31,108],"class_list":["post-974","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net","tag-performance"],"acf":[],"blog_post_summary":"<p>Editor note: This blog is originally published by Christy Henriksson on 03-19-2012 in Web Performance Blog, which will be obsolete soon.&nbsp; 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).&nbsp; I finally decided to create a script so [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/410"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=974"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/974\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}