How to Restart IIS service from vb.net

  • How to Restart IIS service from vb.net

  • 1 Comment sorted by



  • Imports System.ServiceProcess
    Imports System.DirectoryServices

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim sc As New ServiceController("W3SVC")


    If sc IsNot Nothing Then
    If sc.Status = ServiceControllerStatus.Running Then
    sc.Stop()

    Label1.Text = "IIS Server Stop"
    sc.Refresh()
    System.Diagnostics.Process.Start("inetmgr.exe")
    Else

    sc.Start()
    sc.Refresh()
    Label1.Text = "IIS Server Running"

    System.Diagnostics.Process.Start("inetmgr.exe")
    End If

    End If

    End Sub

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Optimum Creative