返回列表 发帖

[问题求助] 求大神看看监控IIS应用程序池的代码有什么问题? 谢谢

想做一个监控IIS应用程序池的程序,下面代码运行就报syntaxerror: invalid syntax 实在不知道错在哪里,格式都是空格没有TAP+空格的混合应用。还请帮忙解答下 谢谢!!
/// <summary>
/// IIS应用地址池监控方法
/// </summary>
private void IISAppPools()
{
try
{
string entPath = "IIS://LOCALHOST/W3SVC/AppPools";
while (true)
{
DirectoryEntry rootEntry = new DirectoryEntry(entPath);
foreach (DirectoryEntry AppPool in rootEntry.Children)
{
if (AppPool.Properties["AppPoolState"].Value.ToString() != "2")
{
LogHelper.Wirte("监控到" + AppPool.Name + "应用地址池停止.");
AppPool.Invoke("Start", null);
AppPool.CommitChanges();
LogHelper.Wirte(AppPool.Name + "应用地址池已成功启动.");
}
AppPool.Close();
}
Thread.Sleep(60000);
}
}
catch (Exception ex)
{
LogHelper.Wirte(ex.ToString());
}
}COPY

返回列表