我想检查 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 及以上版本中,由于内存泄漏问题,servermanager 不能以上述方式使用。我什至在 MSDN 上尝试了以下建议的解决方法-->
var mgr = ServerManager.OpenRemote("localhost");
仍然没有运气。我被困住了,因为我无法在 IIS 8 及更高版本中使用服务器管理器:(任何帮助将不胜感激:)