Friday, January 07, 2005

Stop/Restart IIS in dot net

How to Stop / Start IIS from Vb.Net

To handle windows services .net framework provides System.Serviceprocess.dll so u can restart the any windows service by using ServiceController. so try this code

use reference System.Serviceprocess.dll
in vb.net
Dim sc As New ServiceController()
sc.ServiceName = "IIS Admin"
sc.Stop() ' to stop
sc.Start() ' to Start

No comments: