I am trying to create a .bat file that starts the ASP.NET Dev Server outside of Visual Studio, and then opens the site in a browser开发者_Python百科. What I have so far does successfully start the Dev Server, but then it stops there and doesn't open the browser.
Here is what I have in my .bat file:
"C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start "http://localhost:4608/path-to-site/sitefinity"
Any ideas what is wrong with this? Thanks
UPDATE:
Based upon some of your answers I added the start /B to the first line and now neither the the web server or the browser open. I just get a new empty cmd prompt window. Here is the latest that is not working:
start /B "C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start "http://localhost:4608/path-to-site/sitefinity"
UPDATE 2:
I figured it out with help from you all and some trial and error. See the final solution below.
The following was the final working script:
start /D "C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0" /B WebDev.WebServer.EXE /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start http://localhost:4608/path-to-site/sitefinity/
You'll notice I had to use the /D param to get into the right path (I wanted the user to be able to just run this off of their desktop) and then use /B param to run the given command in the background.
Also, I found that in order to use the start command and just pass it a URL directly to just use the default browser you have to state the URL with no quotes.
You can use the ASP.NET Dev Server for VS 2010 using the following:
start /D "C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0" /B WebDev.WebServer40.EXE /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start http://localhost:4608/path-to-site/sitefinity/
Thanks for everyones help.
Your web server will only be ON until the batch program is running. It will stop after the batch file finishes.
You should use the START
command with the /b
switch to keep it running as a background process. Try this:
start /B webdev.webserver.exe .........
I think you just need a 'start' at the beginning of the first line.
Try this:
start "" /b WebDev.WebServer.EXE
It seems that the first parameter title
becomes not-optional when a switch parameter is used.
Try replacing
c:\Program Files\Common Files\
with
%CommonProgramFiles%\
精彩评论