英語で読む

次の方法で共有


AppDomain.Unload メソッド

ASP.NET アプリケーション ドメインを Web サーバーからアンロードします。

構文

oAppDomain.Unload  
oAppDomain.Unload();  

パラメーター

このメソッドは、パラメーターを受け取りません。

戻り値

このメソッドは値を返しません。

解説

IIS 6.0 の AppUnload コマンドでは、アウトプロセスの ASP アプリケーションをアンロードしました。 IIS 7 の AppDomain.Unload メソッドでは、ASP.NET アプリケーション ドメインをアンロードします。 このメソッドは、マネージド コードにのみ適用できます。 IIS 7 では、AppUnload でサポートされていた IIS 5.0 互換モードが非推奨になったため、AppUnload に対応するメソッドはありません。

以下の例は、アプリケーション ドメインをアンロードする方法を示しています。 この例の最初のセクションでは、IIS Web サーバー上のすべてのアプリケーション ドメインをアンロードします。 2 番目のセクションでは、"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  
  

要件

説明
クライアント - 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
Product - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF ファイル WebAdministration.mof

参照

AppDomain クラス