是否可以使用 NAnt 管理 IIS Web 应用程序?例如停止或启动它?

有帮助吗?

解决方案

也许你可以使用 执行 要执行的任务

iisreset -stop
iisreset -start

编辑 :这个VBS 可能有助于在 IIS 下停止/启动 Web 应用程序

以下是在 IIS 上停止具有 nant 任务的网站的可接受的解决方案:

<target name="stopSite"> 
  <exec program="cscript.exe"> 
    <arg value="C:\windows\system32\iisweb.vbs" /> 
    <arg value="/stop" /> 
    <arg value="test" /> 
  </exec> 
</target>

其他提示

南特有ServiceController的任务与您可以停止/开始只是在Web服务器或整个IIS,我用它通常只停止/启动Web服务器。

<servicecontroller action="Stop" service="w3svc" 
   timeout="10000" verbose="true" />

http://nant.sourceforge.net/release文档可用/latest/help/tasks/servicecontroller.html

如果你喜欢使用PowerShell无论其自身或通过调用南特PowerShell脚本,这是一件轻而易举的事。

IIS:\>Stop-WebAppPool -Name "DefaultAppPool"
IIS:\>Start-WebAppPool -Name "DefaultAppPool"

您也可以下载卡扣这里 http://www.iis.net/download/PowerShell

它的使用的一些注释: http://technet.microsoft.com/en-us/library/ee790599.aspx

您也可以启动/停止个人网站。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top