Site.Stop Method1

停止当前正在运行的网站。

语法

oSite.Stop  
oSite.Stop();  

参数

此方法不采用参数。

返回值

此方法不返回值。

注解

此方法对于 IIS 7 WMI 提供程序来说是新方法,在 IIS 6.0 中没有对应的方法。

示例

以下示例停止名为 IISWebSite 的网站。

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Specify the Web site name.  
Set oSite = oWebAdmin.Get("Site.Name='IISWebSite'")  
  
' Stop the Web site.  
oSite.Stop  

若要在调用 Stop 方法后检查网站的状态,请使用 GetState 方法。

要求

类型 描述
客户端 - IIS 7.0(在 Windows Vista 上)
- IIS 7.5(在 Windows 7 上)
- IIS 8.0(在 Windows 8 上)
- IIS 10.0(在 Windows 10 上)
服务器 - IIS 7.0(在 Windows Server 2008 上)
- IIS 7.5(在 Windows Server 2008 R2 上)
- IIS 8.0(在 Windows Server 2012 上)
- IIS 8.5(在 Windows Server 2012 R2 上)
- IIS 10.0(在 Windows Server 2016 上)
产品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 文件 WebAdministration.mof

另请参阅

Site 类
Site.GetState 方法
Site.Start 方法