<appDomainManagerType > 元素<appDomainManagerType> Element

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

<configuration><configuration>
<运行时 ><runtime>
<appDomainManagerType><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

若要指定应用程序域管理器的类型,您必须同时指定此元素以及 <appDomainManagerAssembly >元素。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.

加载默认应用程序域时,TypeLoadException如果中由指定的程序集不存在指定的类型,则引发 <appDomainManagerAssembly >元素; 并且到进程失败开始日期。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.AppDomainManagerTypeAppDomainSetup.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

下面的示例演示如何指定进程的默认应用程序域的应用程序域管理器是MyMgr中键入AdMgrExample程序集。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