AppDomain.Unload Method

Unloads an ASP.NET application domain from a Web server.

Syntax

oAppDomain.Unload  
oAppDomain.Unload();  

Parameters

This method takes no parameters.

Return Value

This method does not return a value.

Remarks

The IIS 6.0 AppUnload command unloaded out-of-process ASP applications. The IIS 7 AppDomain.Unload method unloads ASP.NET application domains. This method applies only to managed code. IIS 7 has no method that corresponds to AppUnload because the IIS 5.0 compatibility mode that AppUnload supported is now deprecated.

Example

The following example demonstrates how to unload an application domain. The first section of the example unloads all application domains on a Web server. The second section unloads only the application domain named "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  
  

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

AppDomain Class