Ever needed to know which ASP.Net worker process (w3wp.exe) Â belongs to an App Pool? Well I did recently when I needed to attach to it for debugging and there was no obvious way to find out which process related to each app pool. A little bit of research led me to discover AppCmd.exe. I wrote a small batch file which will list them all for you and include the process id. Simply copy the following into a blank text file and save with a .bat extension and you can run it whenever you need to, alternatively just run the command through a standard command prompt.
[code]cd %systemroot%system32inetsrv
appcmd list wps
pause[/code]
You should end up with a line like the following for each worker process on your machine:
[code]WP "5528" (applicationPool:DefaultAppPool)[/code]