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();
            }
        }

猜你喜欢

转载自www.cnblogs.com/kikyoqiang/p/11353414.html