Start IIS website
this.serviceController1 = new ServiceController();
this.serviceController1.ServiceName = "W3SVC";
if (this.serviceController1.Status == ServiceControllerStatus.Stopped)
{
try
{
this.serviceController1.Start();
this.serviceController1.WaitForStatus(ServiceControllerStatus.Running);
MessageBox.Show("已经启动Internet信息服务默认网站。", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}