//添加应用程序池空间引用

using System.DirectoryServices;

 

 

代码
   string method="Start"//Start开启  Recycle回收  Stop 停止
   string AppPoolName = "chengxuchiname";

   
try

   {    

      DirectoryEntry appPool 
= new DirectoryEntry("IIS://localhost/W3SVC/AppPools");

      DirectoryEntry findPool 
= appPool.Children.Find(AppPoolName,"IIsApplicationPool");

      findPool.Invoke(method,
null);

      appPool.CommitChanges();

      appPool.Close();

    MessageBox.Show(
"应用程序池名称启动成功","启动成功"); 

   }

   
catch(Exception ex)

   {

    MessageBox.Show(ex.Message,
"启动失败");      

   }

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2021-04-27
猜你喜欢
  • 2021-10-03
  • 2021-08-25
  • 2022-01-23
  • 2022-12-23
  • 2021-07-28
  • 2021-07-17
  • 2021-10-25
相关资源
相似解决方案