停止IIS服务
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");
转自:http://blog.csdn.net/educast/article/details/6227541
时间: 2024-10-14 10:09:14