How to identify the process ID of a running Sitecore instance

  • 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.

  • Option 1: Using the command line arguments

    This is a straightforward way that does not require any special tools.

    • In IIS Manager, note the application pool name used by the Sitecore site in question.
      For example, let it be called SITECORE7.
    • Open the Windows Task Manager, ensure that the PID and Command Line columns are shown on the screen.
    • For all w3wp.exe processes, check the value of the Command Line argument.
    • Find the w3wp.exe process that has the target application pool name mentioned in the Command Line column.
      For example, the arguments may look like this:
      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
      
    • Get the value of the PID column of this w3wp.exe process.
  • OPtion 2: Using Sitecore log files

    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.

    • Open the folder where Sitecore log files are located, typically "/Data/logs".
    • Find the latest log file that has the format "log.{date}[.time].txt" and open it.
    • Find the line that shows Process ID. It looks as follows:

      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.

  • Option 3: Using appcmd.exe

    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:

    • In the IIS Manager, note the application pool name used by the Sitecore website in question.
    • Open the Windows command line as an Administrator.
    • Type the following command:
      %systemroot%\System32\inetsrv\appcmd.exe list wp
    • Check the output and find the process ID that corresponds to the application pool in question.
      Example of the command's output:

    Notes:

Applies to:

CMS 6+

August 11, 2014
December 06, 2018

Keywords: 

  • CMS,
  • Performance