How to get a list of all the ASP.NET running worker process and its associated application pools?

Ahmed Atia picture Ahmed Atia · Mar 30, 2011 · Viewed 8.2k times · Source

I'm in a need to get a list of all the ASP.NET running worker process and its associated application pools and process ID.

Is there a way to do this pragmatically (C#) or a powershell script?

Answer

HABJAN picture HABJAN · Mar 30, 2011

Identify Worker Process in IIS 6.0

  • Start > Run > Cmd
  • Go To Windows > System32
  • Run cscript iisapp.vbs
  • You will get the list of Running Worker ProcessID and the Application Pool Name.

From IIS 7.0 you need you to run IIS Command Tool ( appcmd ) .

  • Start > Run > Cmd
  • Go To Windows > System32 > Inetsrv
  • Run appcmd list wp

If you want to save that list to text file, just append >> myfile.txt after command.

Now, here you can see iisapp.vbs source code.

It uses WMI to get all the information. Looks simple to rewrite this to C#.

Anyway, complete article where i found this info can be seen here: Identifying Worker Process (w3wp.exe)