As a hosting company we’re frequently having to deal with code run amok from our customers, and the tell tale sign is usually a process consuming a large amount of memory or CPU cycles. If you’re running a VPS in our clour or possibly a dedicated server and are hosting multiple sites, you might need to do this yourself from time to time. Once you find the given process running under w3wp.exe the toughest thing to figure out is which application pool in IIS is causing the issue so you can find which site(s) are at fault. Luckily there are some easy to use tools to hunt that down. Here’s how you do that:
First, find the offending process in the Task Manager, and make sure you can view the process ID. If not showing, go to View in the top menu and select columns and check PID. From there, the process varies from IIS6 to IIS7.
For IIS6:
– Open a command prompt
– Run C:\Windows\system32\cscript iisapp.vbs
– The result will look like the following allowing you to match up the Application Pool Names you have setup in IIS to the Process ID from Task Manager:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
W3WP.exe PID: 3216 AppPoolId: rackwire1.com
W3WP.exe PID: 5012 AppPoolId: rackwire2.com
W3WP.exe PID: 5196 AppPoolId: rackwire3.com
W3WP.exe PID: 4224 AppPoolId: rackwire4.com
W3WP.exe PID: 5856 AppPoolId: rackwire5.com
For IIS7:
- Open a command prompt (Since this is likely a Windows 2008 server, make sure to run as Administrator or you won’t have the needed privileges)
– This time you run C:\Windows\system32\inetsrv\appcmd list wp
– The result will look similar to the above from IIS6, with the same info, but slightly different format:
WP “5128″ (applicationPool:rackwire1.com)
WP “4548″ (applicationPool:rackwire2.com)
WP “6648″ (applicationPool:rackwire3.com)
WP “2408″ (applicationPool:rackwire4.com)
So that’s it, pretty simple overall. Now you will know which app pool is causing you headaches. The next steps are to track down in IIS which sites are running in that app pool to determine which might be at fault.