ApplicationManager 类


为 ASP.NET 宿主应用程序管理 ASP.NET 应用程序域。Manages ASP.NET application domains for an ASP.NET hosting application.

public ref class ApplicationManager sealed : MarshalByRefObject
public sealed class ApplicationManager : MarshalByRefObject
type ApplicationManager = class
    inherit MarshalByRefObject
Public NotInheritable Class ApplicationManager
Inherits MarshalByRefObject


ApplicationManager 对象在 ASP.NET 应用程序的宿主环境中提供对象的生存期管理。The ApplicationManager object provides lifetime management of objects in the hosting environment for an ASP.NET application. 它负责:It is responsible for:

  • 激活并初始化 ASP.NET 应用程序。Activating and initializing ASP.NET applications.

  • 管理应用程序中注册的对象的应用程序生存期和生存期。Managing the application lifetime and the lifetime of objects registered in the application.

  • 公开宿主环境用来处理 ASP.NET 应用程序请求的对象。Exposing objects used by the hosting environment to process ASP.NET application requests.

  • 提供在任意给定时刻在宿主进程中运行的应用程序的列表。Providing a list of applications running in the hosting process at any given moment.



关闭所有应用程序域。Shuts down all application domains.

CreateObject(IApplicationHost, Type)

基于类型创建指定应用程序域的对象。Creates an object for the specified application domain, based on type.

CreateObject(String, Type, String, String, Boolean)

基于以下参数为指定的应用程序域创建一个对象:类型、虚拟路径和物理路径,以及一个指示当指定类型的对象已存在时的失败行为的布尔值。Creates an object for the specified application domain based on type, virtual and physical paths, and a Boolean value indicating failure behavior when an object of the specified type already exists.

CreateObject(String, Type, String, String, Boolean, Boolean)

基于以下参数为指定的应用程序域创建一个对象:类型、虚拟路径和物理路径、一个指示当指定类型的对象已存在时的失败行为的布尔值,以及一个指示是否引发宿主初始化错误异常的布尔值。Creates an object for the specified application domain based on type, virtual and physical paths, a Boolean value indicating failure behavior when an object of the specified type already exists, and a Boolean value indicating whether hosting initialization error exceptions are thrown.


创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)

获取使用指定主机的应用程序的应用程序域。Gets the application domain of an application using the specified host.


获取指定应用程序的应用程序域。Gets the application domain of the specified application.


返回与此 ASP.NET 宿主进程关联的 ApplicationManager 对象的一个实例。Returns the single instance of the ApplicationManager object associated with this ASP.NET host process.


用作默认哈希函数。Serves as the default hash function.

(继承自 Object)

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetObject(String, Type)

从指定的应用程序返回指定类型的注册对象。Returns the registered object of the specified type from the specified application.


返回运行中的应用程序的快照。Returns a snapshot of running applications.


获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)

通过防止创建租约来给予应用程序域无限生存期。Gives the application domain an infinite lifetime by preventing a lease from being created.


返回一个值,该值指示是否该进程承载的所有应用程序都是空闲的且未在处理请求。Returns a value indicating whether all applications hosted by the process are idle and not processing requests.


创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)

使线程安全增量成为应用程序管理器实例的用户参考计数。Makes a thread-safe increment to the user reference count of the application manager instance.


卸载所有应用程序资源。Unloads all application resources.


卸载指定的应用程序。Unloads the specified application.

StopObject(String, Type)

从应用程序中的注册对象列表中移除指定的对象。Removes the specified object from the list of registered objects in an application. 如果要移除的对象是应用程序注册对象列表中剩余的最后一个对象,则该应用程序将被卸载。If the object to be removed is the last remaining object in the list of registered objects in an application, the application is unloaded.


返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)