<Y p e > 元素<appDomainManagerType> Element

指定用作默认应用程序域的应用程序域管理器的类型。Specifies the type that serves as the application domain manager for the default application domain.

<configuration> <configuration>
    <runtime >   <runtime>
     <y p e >    <appDomainManagerType>

语法Syntax

<appDomainManagerAssembly   
   value="type name" />  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
value 必需的特性。Required attribute. 指定类型的名称(包括命名空间),该名称用作进程中默认应用程序域的应用程序域管理器。Specifies the name of the type, including the namespace, that serves as the application domain manager for the default application domain in the process.

子元素Child Elements

无。None.

父元素Parent Elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.

备注Remarks

若要指定应用程序域管理器的类型,必须同时指定此元素和<b l y >元素。To specify the type of the application domain manager, you must specify both this element and the <appDomainManagerAssembly> element. 如果未指定这些元素中的任何一个,则会忽略另一个。If either of these elements is not specified, the other is ignored.

在加载默认应用程序域时,如果指定的类型在<b l y >元素指定的程序集中不存在,则会引发 TypeLoadException;并且进程无法启动。When the default application domain is loaded, TypeLoadException is thrown if the specified type does not exist in the assembly that is specified by the <appDomainManagerAssembly> element; and the process fails to start.

指定默认应用程序域的应用程序域管理器类型时,从默认应用程序域创建的其他应用程序域将继承应用程序域管理器类型。When you specify the application domain manager type for the default application domain, other application domains created from the default application domain inherit the application domain manager type. 使用 "AppDomainSetup.AppDomainManagerType" 和 "AppDomainSetup.AppDomainManagerAssembly" 属性为新的应用程序域指定不同的应用程序域管理器类型。Use the AppDomainSetup.AppDomainManagerType and AppDomainSetup.AppDomainManagerAssembly properties to specify a different application domain manager type for a new application domain.

指定应用程序域管理器类型要求应用程序具有完全信任。Specifying the application domain manager type requires the application to have full trust. (例如,在桌面上运行的应用程序具有完全信任。)如果应用程序不具有完全信任,则会引发 TypeLoadException(For example, an application running on the desktop has full trust.) If the application does not have full trust, a TypeLoadException is thrown.

类型和命名空间的格式与用于 Type.FullName 属性的格式相同。The format of the type and namespace is the same format that is used for the Type.FullName property.

此配置元素仅在 .NET Framework 4 及更高版本中可用。This configuration element is available only in the .NET Framework 4 and later.

示例Example

下面的示例演示如何指定进程的默认应用程序域的应用程序域管理器是 AdMgrExample 程序集中的 MyMgr 类型。The following example shows how to specify that the application domain manager for the default application domain of a process is the MyMgr type in the AdMgrExample assembly.

<configuration>  
   <runtime>  
      <appDomainManagerType value="MyMgr" />  
      <appDomainManagerAssembly   
         value="AdMgrExample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6856bccf150f00b3" />  
   </runtime>  
</configuration>  

请参阅See also