Stop a web site hosted with IIS Express from command line
Asked Answered
B

2

13

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?

Bacteriostasis answered 26/7, 2011 at 21:55 Comment(0)
E
21

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

Expand answered 27/7, 2011 at 2:30 Comment(1)
I had to tweek this slightly to avoid getting an error message when IISExpress wasn't running but it works great now. taskkill /IM IISExpress.exe /FI "STATUS eq RUNNING"Bacteriostasis
C
-1

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

Calibre answered 26/7, 2011 at 21:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.