C#中控制IIS服務重啟

6/30/2006来源:C#应用人气:19429

停止
ServiceController sc = new ServiceController("iisadmin");
if(sc.Status=ServiceControllerStatus.Running)
  sc.Stop();

啟動IIS服務
ServiceController sc = new ServiceController("iisadmin");
  sc.Start();

重啟
using System.Diagnostics;
PRocess.Start("iisreset");