how to get all IIS worker Processes list into my C

2019-07-30 14:23发布

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

1条回答
欢心
2楼-- · 2019-07-30 14:49

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);
}
查看更多
登录 后发表回答