In a process of diagnostic measurements or procedures it may be necessary to identify the ID of the exact Windows process that corresponds to a specific running Sitecore instance.
All ASP.NET processes that run using IIS 6 or later have the name "w3wp.exe".
On a web server that runs only a single ASP.NET site the procedure is very straightforward and can be implemented using the Windows Task Manager and checking the value of the PID column on the tab that lists details of all running processes.
The task becomes more complicated when there are multiple web applications running on a single server.
This is a straightforward way that does not require any special tools.
c:\windows\system32\inetsrv\w3wp.exe -ap "SITECORE7" -v "v2.0" -l "webengine4.dll" -a \\.\pipe\iisipm222a26dd-7290-47e0-b6ec-92d2cbb9846e -h "C:\inetpub\temp\apppools\sitecore7\sitecore7.config" -w "" -m 0 -t 20 -ta 0
When the Sitecore instance starts, it writes its corresponding process ID to the log file. Sitecore logs can be used to determine a current process ID of a running Sitecore instance.
9028 13:46:52 INFO Microsoft.NET version 4.0.30319.18051
9028 13:46:52 INFO
9028 13:46:52 INFO Process id: 7176
9028 13:46:52 INFO Windows identity used by the process: NT AUTHORITY\NETWORK SERVICE. Impersonation: False
9028 13:46:52 INFO Managed pipeline mode: Integrated
Note: If Sitecore website has been running for a while, it may take some time to find the log file that corresponds to the latest startup.
The AppCmd.exe tool can be used to list all the running ASP.NET worker processes. The resulting output will contain application pool names alongside the process IDs.
To use the tool, follow the instructions below:
%systemroot%\System32\inetsrv\appcmd.exe list wp
Notes: