Navin Leon
Navin Leon

Reputation: 1166

Restart WebDev.WebServer

How can I restart WebDev.WebServer in ASP.NET through code? I'm able to stop it, but I'm not able to start again.

Upvotes: 2

Views: 3661

Answers (2)

TBohnen.jnr
TBohnen.jnr

Reputation: 5129

Do a search in your c:\ (Windows drive) for WebDev.WebServer.EXE, I've found articles saying it's in the v2.xxx folder of the framework but myne was located in (different versions):

C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE

C:\Program Files\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer20.EXE

C:\Program Files\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.EXE

to start run it from the command line with the following parameters:

WebDev.WebServer.EXE /path:"[Your site directory]"

From Code:

System.Diagnostics.Process.Start(@"C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE", "/path:c:\inetpub\wwwroot\testSite");

Upvotes: 4

Farzin Zaker
Farzin Zaker

Reputation: 3606

You can not start webserver using code again because no process exists to run you code to do that!

webserver process is running your code. so when you stoped it, who should run your code to start webserver again??

you should look for a restart method instead of a stop and then a start method.

another simple solution is that create an external executable file that will stop and then start the procee of webserver. then you just need to start that executable file ;)

Upvotes: 3

Related Questions