<appDomainManagerAssembly > 元素<appDomainManagerAssembly> Element

針對處理序中的預設應用程式網域,指定提供應用程式網域管理員的組件。Specifies the assembly that provides the application domain manager for the default application domain in the process.

<configuration> <configuration>
    <runtime >   <runtime>
     <appDomainManagerAssembly >    <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

若要指定應用程式域管理員的類型,您必須同時指定這個元素和<appDomainManagerType >元素。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.

載入預設應用程式域時,如果指定的元件不存在,或是元件不包含由<appDomainManagerType >元素所指定的類型,就會擲回 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.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.

如需元件顯示名稱的格式,請參閱 Assembly.FullName 屬性。For the format of the assembly display name, see the Assembly.FullName property.

此 configuration 元素僅適用于 .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