<B l y > 元素<appDomainManagerAssembly> Element

指定为过程中的默认应用程序域提供应用程序域管理器的程序集。Specifies the assembly that provides the application domain manager for the default application domain in the process.

<configuration> <configuration>
    <runtime >   <runtime>
     <b l y >    <appDomainManagerAssembly>

语法Syntax

<appDomainManagerAssembly   
   value="assembly display name" />  

特性和元素Attributes and Elements

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

特性Attributes

特性Attribute 描述Description
value 必需的特性。Required attribute. 指定为进程中的默认应用程序域提供应用程序域管理器的程序集的显示名称。Specifies the display name of the assembly that provides 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

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

在加载默认应用程序域时,如果指定的程序集不存在,或者如果程序集不包含由<y p e >元素指定的类型,则会引发 TypeLoadException;并且进程无法启动。When the default application domain is loaded, TypeLoadException is thrown if the specified assembly does not exist or if the assembly does not contain the type specified by the <appDomainManagerType> element; and the process fails to start. 如果找到程序集,但版本信息不匹配,则会引发 FileLoadExceptionIf the assembly is found but the version information does not match, a FileLoadException is thrown.

指定默认应用程序域的应用程序域管理器类型时,从默认应用程序域创建的其他应用程序域将继承应用程序域管理器类型。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.

有关程序集显示名称的格式,请参见 Assembly.FullName 属性。For the format of the assembly display name, see the Assembly.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