This article has been moved to its new home here: https://benperk.github.io/msdn/2011/2011-12-finding-the-w3wp-worker-process-pid-and-associated-id.html
When you have multiple websites running under different application pools on the same server, you may need to trouble shoot a specific worker process.
On Windows 2003 and Internet Information Services 6 (IIS6), I use the iisapp.vbs script as shown in following command, as shown in Figure 1:
Figure 1, Find AppPoolId using IIS 6
On Windows 2008 and Internet Information Services 7 (IIS 7 or IIS 7.5) or Windows 2012 (IIS 8 or IIS 8.5), I use the appcmd application passing it the wps parameter as displayed below, as shown in Figure 2:
Figure 2, Find applicationPoolId using IIS 7, IIS 7.5, IIS 8 or IIS 8.5
Then use the memory dump to analyze and find the root cause of the problem.