c# 操作IIS应用程序池
生活随笔
收集整理的這篇文章主要介紹了
c# 操作IIS应用程序池
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
直接代碼:
?
代碼 using System.DirectoryServices; // 添加引用 System.DirectoryServicestry
{
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 未找到!");
}
?
總結
以上是生活随笔為你收集整理的c# 操作IIS应用程序池的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: asp.net 取windows的所有进
- 下一篇: Android 手机发送短信