IIS 应用程序池回收(代码实现)

回收

复制代码
        public void StartStopRecycleApp(string appName = "项目DLL名称", string method = "Recycle")
        {
            using (DirectoryEntry appPool = new DirectoryEntry("IIS://localhost/W3SVC/AppPools"))
            using (DirectoryEntry findPool = appPool.Children.Find(appName, "IIsApplicationPool"))
            {
                findPool.Invoke(method, null);
                appPool.CommitChanges();
                appPool.Close();
            }
        }
复制代码

 

posted @   一只桔子2233  阅读(326)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示