直接代码:

 

代码
using System.DirectoryServices; // 添加引用 System.DirectoryServices

try
{
DirectoryEntry appPool
= new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
DirectoryEntry findPool
= appPool.Children.Find("DefaultAppPool", "IIsApplicationPool");
findPool.Invoke(
"Start", null); // Start|Stop|Recycle [Recycle:应用程序池回收,如果状态为Stop会报错]
appPool.CommitChanges();
appPool.Close();
Response.Write(
"DefaultAppPool 操作成功!");
}
catch (Exception ex)
{
Response.Write(
"DefaultAppPool 未找到!");
}

 

相关文章:

  • 2021-11-23
  • 2021-12-19
  • 2021-11-17
  • 2021-05-05
  • 2021-12-29
  • 2021-12-05
  • 2021-11-20
  • 2021-05-29
猜你喜欢
  • 2021-05-21
  • 2021-11-28
  • 2021-11-28
  • 2021-11-29
  • 2021-12-19
  • 2021-11-17
  • 2021-12-07
  • 2021-11-23
相关资源
相似解决方案