问题
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