【发布时间】:2018-01-16 17:49:22
【问题描述】:
我正在尝试将应用程序池 CPU 使用量大小保持在 db 中。有很多应用程序池,我不知道哪个应用程序池的大小。我必须这样做:
应用程序池 id - db 中的 cpu 使用大小
但我不知道如何获取应用程序池标识。我是这样做的;
var appPoolPath = @"IIS://" + Environment.MachineName + "/W3SVC/AppPools";
using (var w3svc = new DirectoryEntry(appPoolPath))
{
foreach (DirectoryEntry item in w3svc.Children)
{
// i can get name like item.Name
//but
// i need current app pool id in loop
}
}
但我发现每个应用程序池都有相同的 Guid。是不是一定要不同?
【问题讨论】:
-
请学习
Microsoft.Web.AdministrationAPI。你使用的东西已经过时了。 -
我知道这一点,但我正在处理它,我看不到任何 appPool 的标识。再次感谢您的帮助 :) @LexLi