AppDomain Class [IIS 7 and higher]

Represents an IIS application domain.

Syntax

class AppDomain : Object

Methods

The following table lists the methods exposed by the AppDomain class.

Name

Description

Unload

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

Properties

The following table lists the properties exposed by the AppDomain class.

Name

Description

Id

A read-only string value that contains a unique identifier for the application domain. A key property.

IsIdle

A read-only boolean value. true if the application domain is currently idle; otherwise, false.

PhysicalPath

A read-only string value that contains the physical path of the application.

ProcessId

A read-only uint32 value that contains the ID of the process in which the application domain is loaded.

SiteName

A read-only string value that contains the name of the Web site to which the application domain belongs. A key property.

ApplicationPath

A read-only string value that contains the virtual path of the application domain. A key property.

Subclasses

This class contains no subclasses.

Remarks

When a request first enters managed code (managed modules or handlers), the IIS ManagedEngine module creates an application domain. The application domain then performs necessary processing tasks, such as authenticating a user with Forms authentication or other application services provided by managed code.

Example

The following example shows how you can retrieve and enumerate the application domains on Web server. If no application domains are active, the script does not return a result.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the currently existing application domains.
Set oAppDomains = oWebAdmin.ExecQuery("SELECT * FROM AppDomain")

' Loop through each application domain and display its properties.
For Each oAppDomain In oAppDomains 
    WScript.Echo "--------------------------------------"
    WScript.Echo "AppDomain Application Path:   " & oAppDomain.ApplicationPath
    WScript.Echo "AppDomain ID:   " & oAppDomain.ID
    WScript.Echo "AppDomain IsIdle:   " & oAppDomain.IsIdle
    WScript.Echo "AppDomain Physical Path:   " & oAppDomain.PhysicalPath
    WScript.Echo "AppDomain ProcessID:   " & oAppDomain.ProcessID
    WScript.Echo "AppDomain SiteName:   " & oAppDomain.SiteName
Next

The following example output is based on two domains named Northwind and Proseware located below the default Web site:

--------------------------------------
AppDomain Application Path:          /Northwind/
AppDomain ID:          /LM/W3SVC/1/ROOT/Northwind
AppDomain IsIdle:        False
AppDomain Physical Path: D:\inetpub\NorthwindApp\
AppDomain ProcessID:           3800
AppDomain SiteName:           Default Web Site
--------------------------------------
AppDomain Application Path:          /Proseware/
AppDomain ID:          /LM/W3SVC/1/ROOT/Proseware
AppDomain IsIdle:        True
AppDomain Physical Path: D:\inetpub\ProsewareApp\
AppDomain ProcessID:           3800
AppDomain SiteName:           Default Web Site

Inheritance Hierarchy

Object

   AppDomain

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

Object Class [IIS 7 and higher]

Other Resources

HTTP Request Processing in IIS 7.0