C#中控制IIS服务停止
ServiceController sc = new ServiceController("iisadmin");
if(sc.Status=ServiceControllerStatus.Running)
sc.Stop();
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");