how to get all IIS worker Processes list into my Console Application?

假如想象 提交于 2019-12-11 05:47:18

问题


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:


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);
}


来源:https://stackoverflow.com/questions/41379819/how-to-get-all-iis-worker-processes-list-into-my-console-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!