【发布时间】:2015-07-31 04:55:37
【问题描述】:
我想检查 IIS 中是否存在应用程序池。为此,我使用 servermanager 如下-->
ServerManager mgr = new ServerManager();
if (mgr.ApplicationPools["myapplicationpoolname"] == null)
{
//My Procedure to create application pool as app pool doesnt exist
}
这在 IIS 7.5 及以下版本上运行顺利。但在 IIS 8 及以上版本中,由于内存泄漏问题,无法使用上述方式。我什至在 MSDN 上尝试了以下建议的解决方法-->
var mgr = ServerManager.OpenRemote("localhost");
仍然没有运气。由于无法在 IIS 8 及更高版本中使用 servermanager,我感到很困惑:(任何帮助将不胜感激:)
【问题讨论】:
-
我终于使用 appcmd.exe 参数解决了我的问题 :)..可能没有其他选择 :)
标签: c# application-pool servermanager