Stop IIS 7 Application Pool from build script

Posted by Andrew Hanson on Stack Overflow See other posts from Stack Overflow or by Andrew Hanson
Published on 2009-09-08T18:22:41Z Indexed on 2010/04/08 7:03 UTC
Read the original article Hit count: 524

Filed under:
|

How can I stop and then restart an IIS 7 application pool from an MSBuild script running inside TeamCity. I want to deploy our nightly builds to an IIS server for out testers to view.

I have tried using appcmd like so:

appcmd stop apppool /apppool.name:MYAPP-POOL

... but I have run into elevation issues in Windows 2008 that so far have stopped me from being able to run that command from my TeamCity build process because Windows 2008 requires elevation in order to run appcmd.

If I do not stop the application pool before I copy my files to the web server my MSBuild script is unable to copy the files to the server.

Has anybody else seen and solved this issue when deploying web sites to IIS from TeamCity?

© Stack Overflow or respective owner

Related posts about teamcity

Related posts about msbuild