Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to stop and restart IIS using VB code?
Posted
Updated 4-Jan-11 22:56pm
v3

Use
VB
System.Diagnostics.Process.Start("iisreset /stop"); 'Stop IIS

System.Diagnostics.Process.Start("iisreset"); 'Restart IIS
 
Share this answer
 
Check the following article
Stop/Start IIS Website in .NET

Accept the answer if found useful :)
 
Share this answer
 
Comments
Espen Harlinn 5-Jan-11 6:13am    
5+ - Useful link
Sandesh M Patil 5-Jan-11 6:14am    
Thanks mate
JF2015 5-Jan-11 8:24am    
Good!
Yeah 'iisreset' is the way to go. You can use the Process class to kick it off.

Something along the lines of...

Process iisrestart = new Process();
iisrestart.StartInfo.FileName = "iisreset.exe";
iisrestart.StartInfo.Arguments = "COMPUTER_NAME";
iisrestart.Start();
 
Share this answer
 
Try to invoke this command from your vb code..,

http://kb.atempo.com/article.asp?aid=188[^]
 
Share this answer
 
Comments
Toniyo Jackson 5-Jan-11 4:46am    
I need VB code.
Rajesh Anuhya 5-Jan-11 4:58am    
Use System.Diagnostics.Process to invoke the process(Command).
Try
This[^]

OR

it works by Using Service Controller
Restart-Service-VBNET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900