On certain machines, I'm repeatedly using remote desktop to access a Windows 2003 server so that I can debug something running in the context of ASP.NET (web app, web service, etc). Since various apps and services on these machines are segregated in different app pools, the first thing I have to do when I run something like VS.NET and bring up the attach-to-process dialog is figure out which running instance of w3wp.exe is the one I need to attach to. Sometimes I get lucky and pick the right instance on the first try. Other times I miss and have to try the others one at a time. While this isn't something that takes a tremendous amount of time, the repetitive nature of this drives me nuts.
So I finally sat down and wrote a little script to automate this annoying procedure for me. The result is a javascript file that I can just run with the name of the app pool I'm interested in debugging on the command line, like so:
c:\>apdebug AcmeAppPool
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Active app pools...
AcmeAppPool (2860)
MSSharePointAppPool (3268)
DefaultAppPool (3652)
Launching debugger for 'AcmeAppPool' (2860)...
The script enumerates the running instances of w3wp.exe, displaying the app pool they host and their corresponding process ID, then launches the JIT debugging dialog if the app pool specified on the command line was active. Since I'm very often interested in the same app pool on a given machine, a desktop shortcut to that script with the right app pool name on the command line gets me to the right spot with just a double click.
A more detailed description, with sample output and a screenshot, along with links to the script source you can view and/or download for your own use
can be found here.
Posted
Aug 16 2006, 11:37 AM
by
mike-woodring