开发者

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开发者_StackOverflow中文版 again.


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");


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 ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜