<appDomainManagerType > 元素<appDomainManagerType> Element

針對預設應用程式網域,指定做為應用程式網域管理員的類型。Specifies the type that serves as the application domain manager for the default application domain.

<configuration> <configuration>
    <runtime >   <runtime>
     <appDomainManagerType >    <appDomainManagerType>


   value="type name" />  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.


屬性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


父項目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.


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

載入預設應用程式域時,如果指定的型別不存在於由<appDomainManagerAssembly >元素所指定的元件中,就會擲回 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.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.

此 configuration 元素僅適用于 .NET Framework 4 和更新版本。This configuration element is available only in the .NET Framework 4 and later.


下列範例示範如何指定進程的預設應用程式域的應用程式域管理員,是 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.

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

請參閱See also