Debugging SharePoint, which Process?

When developing 3rd party components for SharePoint you cannot avoid debugging.  Debugging usually involves attaching to a W3WP.EXE process – IIS host for a SharePoint application, from within Visual Studio. 

When presented with the attach to process dialog box, you should typically see two to three instances of W3WP.EXE, one for central administration site, maybe another for the SSP administration site, and one for your web application:


So.. which process should you attach?  Most developers (myself included) attach to all – just to be sure.  But what if you want to know exactly which process to attach? 

My colleague – Kevin Vieira gave made me aware of IISAPP.EXE – a nice built in tool to list all of IIS hosted web applications with associated PID:

W3WP.exe PID: 236   AppPoolId: SharePoint – 80
W3WP.exe PID: 244   AppPoolId: SharePoint – 5000
W3WP.exe PID: 3616   AppPoolId: SharePoint Central Administration v3