jrockers
jrockers

Reputation: 535

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?

Upvotes: 14

Views: 15365

Answers (2)

vikomall
vikomall

Reputation: 17539

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

Upvotes: 22

NoAlias
NoAlias

Reputation: 9193

Windows PowerShell's Stop-WebSite cmdlet is a command line way of stopping a Website hosted on IIS.

Upvotes: -1

Related Questions