Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop a web site hosted with IIS Express from command line

I'm working on a web solution in Visual Studio 2010 that is using IIS Express to host the application. I want the build process to copy the output DLLs from some of the projects into a directory under the main web app. There is a watch on this directory that keeps MEF current. The problem is that my builds fail because they can't copy the dlls over the existing ones because the application is left running every time I debug. What I'd like to do is add a build command that stops the site before the build begins.

I was expecting to be able to run AppCmd Stop Site "MySiteName" but appcmd says that STOP is not supported for site objects.

Are there any ways to stop a site from running in iis express from the command line?

like image 649
jrockers Avatar asked Jul 26 '11 21:07

jrockers


People also ask

How do I stop a website from command line using IIS?

At the command prompt, type net stop WAS and press ENTER; type Y and then press ENTER to stop W3SVC as well.

How do you stop IIS Express running?

The best way to be able to exit Debug mode and leave iisexpress running is to start your application without the debugger in the first place, <ctrl + F5> and then attach the Debugger <ctrl + alt + p> to the iisexpress process, you'll see it on the list.

How do I run IIS Express from command line?

In the command box type runphp . The command file will configure IIS Express to use the website directory as a website. The website can now be opened in the browser using the localhost and port configured by IIS Express, default is localhost:8080 (see the bindingInformation in the apphost.


1 Answers

Option-1:

If you don't have any other sites running, try

"taskkill /IM iisexpress.exe"

Note: This stops all iisexpress.exe processes

Option-2:

Write some executable utility for doing this. Following link may help you! Starting and stopping IIS Express programmatically

like image 72
vikomall Avatar answered Nov 08 '22 05:11

vikomall