Identify which w3wp.exe belongs to which Application Pool in IIS7
If Windows Task manager shows excessive resource usage (CPU or memory, mostly) for an IIS 7 worker process (w3wp.exe), it's helpful to identify which of your application pools consumes the resources. I haven't found a way to accomplish this in IIS Manager so I proceeded like so: At the command prompt: net start WAS Note: WAS is the Windows Process Activation Service (btw, pretty silly service name, as it's nigh impossible to google for WAS). Run appcmd list wp: **C:\Windows\system32>%windir%/system32/inetsrv/appcmd list wp **WP "5716" (applicationPool:DefaultAppPool) WP "968" (applicationPool:MyOtherAppPool) WP "5836" (applicationPool:TheThirdAppPool) The number in the results is the process ID in the results is the Windows process ID (PID). Now in Windows Task Manager, after having enabled the PID column in View>Select Columns... you can identify the offending w3wp.exe by its PID. If you have an easier way to do this, please post in the comments.
Bill Staples: Sure, it's easy in IIS Manager. Just click on the 'Worker Process' feature in IIS Manager (you have to be clicking on a server in the left hand pane tree view). This will also show you CPU and memory usage for a given AppPool.
dirk: Thanks Bill, much easier indeed. I guess I was clicking the Application Pools in the left pane and couldn't move to the worker processes from there.
An Phu: @Bill, Nice one! I wanted to add that when remote debugging, make sure your app pool is running by making an initial request and set "Ping Enabled" to false under the Process Model category in the app pool's Advanced Settings.
Sace: Hi I just want to inform that Bill's comment does not work with my server. It show "category does not exist" but Dirk's command work fine.
Rob: Very cool find... I used to have a script (vbscript) which would pull values from PerfMons for various memory levels and would associate the PID to the AppPool name (edited version of iisapps.vbs), but since the Microsoft.CmdLib isn't in 2008 I don't have that. Anyone know another way to be able to set up a task that would give you PID, AppPool name, CPU (since it's there), Physical memory, worker memory, etc..?
Posted: 01 June 2008