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