How to start/stop IIS service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I used the following code to manage IIS service

Dim iis As New System.ServiceProcess.ServiceController("IIS Admin Service")
If iis.Status() = ServiceProcess.ServiceControllerStatus.Stopped Then
iis.Start()
End If

but IIS couldn't start. Did I do the correct thing?
 
System.Diagnostics.Process.Start("C:\WINDOWS\System32\inetsrv\inetinfo.exe")
 
Back
Top