IIS 站点和 nant/nantcontrib?

发布于 2024-07-14 07:48:55 字数 47 浏览 4 评论 0原文

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

is it possible to manage IIS web applications with NAnt?
For example stop or start it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

再见回来 2024-07-21 07:48:55

Nant 具有 servicecontroller 任务,您可以使用它来仅停止/启动 Web 服务器或整个 IIS,我通常使用它来停止/启动 Web 服务器。

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

文档位于 http://nant.sourceforge.net/release/latest/帮助/任务/servicecontroller.html

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

于我来说 2024-07-21 07:48:55

也许您可以使用 exec 任务来执行

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>

Maybe you can use exec task to execute

iisreset -stop
iisreset -start

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 :

<target name="stopSite"> 
  <exec program="cscript.exe"> 
    <arg value="C:\windows\system32\iisweb.vbs" /> 
    <arg value="/stop" /> 
    <arg value="test" /> 
  </exec> 
</target>
意中人 2024-07-21 07:48:55

如果您喜欢单独使用 Powershell 或通过 Nant 调用 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

您还可以启动/停止单个网站。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文