is it possible to manage IIS web applications with NAnt? For example stop or start it?
IIS site and nant/nantcontrib?
2.5k Views Asked by Andrey Selitsky At
3
There are 3 best solutions below
1

Nant has the servicecontroller task with which you can either stop/start just the Web server or entire IIS, i use it generally to just stop/start the web server.
<servicecontroller action="Stop" service="w3svc"
timeout="10000" verbose="true" />
Documentation available at http://nant.sourceforge.net/release/latest/help/tasks/servicecontroller.html
0

If you like using Powershell either on its own or calling a powershell script through Nant this is a breeze.
IIS:\>Stop-WebAppPool -Name "DefaultAppPool"
IIS:\>Start-WebAppPool -Name "DefaultAppPool"
You can download the snap-in here http://www.iis.net/download/PowerShell
Some Notes on its use: http://technet.microsoft.com/en-us/library/ee790599.aspx
You can also start/stop individual websites.
Maybe you can use exec task to execute
EDIT : And this VBS might help for stopping/starting WebApplications under IIS
Here is the accespted solution to stop a website with nant task on IIS :