Tuesday, November 6, 2012

How to find which w3wp.exe belongs to which application pool and Find correct w3wp ProcessId for Web Application in IIS: IIS 6.0 and IIS 7.0

Today we see some performance issue on two of our webservers and I was supposed to the analysis of the it.
I know this is tuff Job but work is worship so no compromise.
We had similar problem in the past as well; however, our Search 2008 server has contributed to the server CPU utilization to 100 %. We stopped all search crawls in the past and issue was resolved.
Today is another scary day when we saw the search was stopped and still CPU is at 100 % of it utilization on two of our servers.
I noticed from the task manager that multiple instances of w3wp.exe was running and some of them was eating up the completed memory.
Enabled the PID from Process Tab -> View -> Select Columns -> Select PID.
PID is a unique process ID associated with each process running on the server or client.
Why this PID was required?
To compare the PID associated with each and w3wp.exe. Now questions comes to mind is how we can know which web application or which application pool is binded with which worker process. Below is the answer…J
How to find which w3wp.exe belongs to which application pool: Applicable to Server 2003
If you have multiple application pools on your IIS 6.0 web server you have certainly already noticed (in Task Manager) that you have multiple w3wp.exe processes running. If you notice a problem with one of these processes (for example consuming much memory, or taking too much CPU power) the following question arises: How do I know which application pool this process belongs to, so I know what application is causing this? It may sound like an easy to answer question, and it is, if you know the solution!
The command-line script iisapp.vbs can be used to view which application pool a worker process belong to (a w3wp.exe process in Task Manager). This script is stored in the systemroot\system32 folder. To run this script open a command prompt.

C:\WINDOWS\system32>cscript.exe iisapp.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

W3WP.exe PID: 1188 AppPoolId: DefaultAppPool
The example above tells us that the w3wp.exe with PID 1188 belongs to the application pool called DefaultAppPool. The syntax for this script is:

iisapp [/a AppPoolName | /p PID]

So you can also search for a specific application pool by specifying the PID, or vice versa (search for a PID by specifying the application pool name).
Find correct w3wp ProcessId for Web Application in IIS: Applicable to Server 2008.
To debug SharePoint assets such as web control (.ascx) in development environment, it’s very important to attach correct w3wp processId to visual studio.
Following is the process to find correct w3wp ProcessId for specific web Application in IIS, Please note that the step below is applied only to Windows 2008  and IIS 7
1.      Go to Start >> RUN >> cmd
2.      Copy following command >> %windir%\system32\inetsrv\appcmd.exe list wp
3.      This will list all web applications w3wp process with id as follows.

4.  From the list you can find the processId of particular web application and attach it to visual studio for debug.
Ref:  www.sohilmakwana.wordpress.com

To know more about this:

If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues.

No comments:

Post a Comment