i have a server in which i published a asp.net web site. i want to create a console application which show how many worker processes are in the IIS. please any help
Asked
Active
Viewed 2,115 times
1
-
1http://stackoverflow.com/questions/30868022/how-to-get-the-current-list-of-worker-request-from-iis-using-c – Mahdi Dec 29 '16 at 12:34
-
Do you need all processes inside server or just related to IIS pipeline (modules)? – VadimB Dec 29 '16 at 12:34
-
yes i need all processes inside iis – vijay joshi Dec 29 '16 at 13:01
1 Answers
1
You can add this reference in project Microsoft.Web.Administration
assembly which can be installed using this nuget package or by adding a reference to this dll %WinDir%\System32\InetSrv\Microsoft.Web.Administration.dll
using (ServerManager manager = new ServerManager())
{
var requests = manager.ApplicationPools
.SelectMany(pool => pool.WorkerProcesses).Count();
Console.WriteLine(requests);
}

Ahmar
- 3,717
- 2
- 24
- 42
-
i used this code but it throw below error . Additional information: Retrieving the COM class factory for component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). – vijay joshi Dec 29 '16 at 13:08
-
-
-
no i don't, IIS is installed on another machine(window server 2016). – vijay joshi Dec 30 '16 at 09:49
-
Run this code on where you installed IIS. It will work there. You except output on your system while the output source IIS not present. That's why it give error to you. – Ahmar Dec 30 '16 at 09:54