Uncategorized

Find which w3wp.exe instance is hosting your application

Just a quick and easy one for this Friday evening: let’s say you have multiple w3wp.exe instances running on your web server (maybe you have multiple application pools, or you enabled Web Garden etc…), one of the ASP.NET applications you have on that server has some problems and you need to capture a memory dump to troubleshoot it: what can you do?

Easy one: install the Debugging Tools for Windows and run adplus with something like the following:

cscript adplus.vbs -hang -pn w3wp.exe

But, hey, you don’t want to end up with a full dump for every w3wp.exe loaded in memory, you just need one of them, the one which is hosting your application… ๐Ÿ™„

Well… here is where iisapp.vbs comes to the rescue! ๐Ÿ˜Šย You can find it under C:\Windows\System32 folder on your Windows 2003 machine, and if you simply run it at the command line, it’ll print to the console the PID of all w3wp.exe processes running and the Application Pool ID that particular process is hosting; here is a screenshot I just took in my machine:

pslist
pslist

Since you are supposed to know under which application pool your application is running (and if you don’t know you can check it through the IIS Management Console) you are ready to go! Let’s say I want to dump an application running under “Live” App Pool:

cscript adplus.vbs -hang -p 4612

Here we go; not comes the tricky (and funny) part: analyze the dump ๐Ÿค“

Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.