操作iis

以后研究

       try
            {
                string method = "Recycle";
                string AppPoolName = "z.chinabett.com";
                DirectoryEntry appPool = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
                DirectoryEntry findPool = appPool.Children.Find(AppPoolName, "IIsApplicationPool");
                findPool.Invoke(method, null);
                appPool.CommitChanges();
                appPool.Close();
                string a = string.Format("回收应用程序池{0}成功", AppPoolName, method);
            }
            catch (Exception ex)
            {
                throw ex;
            }

 

posted @ 2016-07-26 09:24    阅读(162)  评论(0编辑  收藏  举报