共用方式為


AppDomain.Unload 方法

從 Web 服務器卸載 ASP.NET 應用程式域。

語法

oAppDomain.Unload  
oAppDomain.Unload();  

參數

此方法不會採用任何參數。

傳回值

這個方法不會傳回值。

備註

IIS 6.0 AppUnload 命令已卸載跨進程 ASP 應用程式。 IIS 7 AppDomain.Unload 方法會卸載 ASP.NET 應用程式域。 這個方法只適用于 Managed 程式碼。 IIS 7 沒有對應的 AppUnload 方法,因為支援的 IIS 5.0 相容性模式 AppUnload 現在已被取代。

範例

下列範例示範如何卸載應用程式域。 範例的第一個區段會卸載網頁伺服器上的所有應用程式域。 第二個區段只會卸載名為 「Northwind」 的應用程式域。

' ---- Unload all application domains. ----  
' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get all of the application domains on the Web server.  
Set oAppDomains = oWebAdmin.ExecQuery("SELECT * FROM AppDomain")  
  
' Unload all of the application domains.  
  
For Each oAppDomain In oAppDomains  
    oAppDomain.Unload  
Next  
  
' ---- Unload only the Northwind application domain. ----  
' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get all of the application domains on the Web server.  
Set oAppDomains = oWebAdmin.ExecQuery("SELECT * FROM AppDomain")  
  
' Unload the Northwind application domain.  
For Each oAppDomain In oAppDomains  
    If oAppDomain.ApplicationPath = "/Northwind/" Then  
        oAppDomain.Unload  
    End If  
Next  
  

規格需求

類型 描述
Client - Windows Vista 上的 IIS 7.0
- Windows 7 上的 IIS 7.5
- Windows 8 上的 IIS 8.0
- Windows 10上的 IIS 10.0
伺服器 - Windows Server 2008 上的 IIS 7.0
- Windows Server 2008 R2 上的 IIS 7.5
- Windows Server 2012 上的 IIS 8.0
- Windows Server 2012 R2 上的 IIS 8.5
- Windows Server 2016上的 IIS 10.0
產品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 檔案 WebAdministration.mof

另請參閱

AppDomain 類別