Monday, January 12, 2009

Using Powershell script to start and stop web services during development

I have been developing some Web Services under VS2008 and Vista 64.

For some reason whenever I tried to test the services under VS2008 I received the message :

Unable to launch the ASP,NET Development Server because port XXXX is in use.

I decided to start and stop the services manually using Powershell and, if debugging was required to used the "Debug->Attach to Process" facility.

Here is the Powershell command to start an instance of the development server on a specified port:

&"C:\Program Files (x86)\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE" /port:1420 /path:"C:\Users\User Name\Documents\Code\Services\Status"

Here is the Powershell command to stop all instances of the development server:


&stop-process -name WebDev.WebServer -confirm



Regards

Andy

No comments: