AppDomainManager クラス
アセンブリ: mscorlib (mscorlib.dll 内)


AppDomainManager クラスを実装すると、ホスト アプリケーションを新しいアプリケーション ドメインの作成に関与させることができます。既定の AppDomainManager を置き換えるには、APPDOMAIN_MANAGER_ASM 環境変数および APPDOMAIN_MANAGER_TYPE 環境変数の置換 AppDomainManager のアセンブリおよび型を識別します。アセンブリは、完全に信頼されている必要があります。また、グローバル アセンブリ キャッシュまたは先頭のアプリケーションのディレクトリ内に含まれている必要があります。型名およびアセンブリ名は、環境変数で完全修飾されている必要があります。次に例を示します。
set APPDOMAIN_MANAGER_TYPE=MyNamespace.TestAppDomainManager
set APPDOMAIN_MANAGER_ASM=customappDomainmanager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f1368f7b12a08d72
AppDomainManager は、アンマネージ ホストに対応するマネージ ホストです。AppDomainManager オブジェクトは、1 つのプロセスでの新しいアプリケーション ドメインの作成に使用されます。また、このオブジェクトを使用すると、他のマネージ コードを実行する前に、新しい AppDomain をカスタマイズできます。AppDomainManager は、共通言語ランタイムの実行の別の面に参加するホスト マネージャを提供することもできます。たとえば、AppDomainManager によって、アプリケーション ドメインのセキュリティの決定に関与する HostSecurityManager オブジェクトを指定できます。
![]() |
---|
グローバル アセンブリ キャッシュ内のアセンブリのように FullTrust が与えられたアセンブリや、AppDomain.CreateDomain(String,Evidence,AppDomainSetup,PermissionSet,StrongName[]) メソッドで fullTrustAssemblies として識別できるアセンブリのみを、AppDomainManager コンストラクタおよび InitializeNewDomain メソッドに読み込むことができます。 |
![]() |
---|
このクラスには、クラス レベルのリンク確認要求と継承確認要求が含まれます。直前の呼び出し元または派生クラスにインフラストラクチャ アクセス許可がない場合、SecurityException がスローされます。セキュリティ要求の詳細については、「リンク確認要求」および「継承確認要求」を参照してください。
|

AppDomainManager の非常に単純な実装を次のコード例に示します。
' To replace the default AppDomainManager, identify the ' replacement assembly and replacement type in the ' APPDOMAIN_MANAGER_ASM and APPDOMAIN_MANAGER_TYPE ' environment variables. For example: ' set APPDOMAIN_MANAGER_TYPE=library.TestAppDomainManager ' set APPDOMAIN_MANAGER_ASM=library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f1368f7b12a08d72 Imports System Imports System.Collections Imports System.Net Imports System.Reflection Imports System.Security Imports System.Security.Permissions Imports System.Security.Policy Imports System.Security.Principal Imports System.Threading Imports System.Runtime.InteropServices <assembly: System.Security.AllowPartiallyTrustedCallersAttribute()> <SecurityPermissionAttribute(SecurityAction.LinkDemand, _ Flags:=SecurityPermissionFlag.Infrastructure)> _ <SecurityPermissionAttribute(SecurityAction.InheritanceDemand, _ Flags:=SecurityPermissionFlag.Infrastructure)> _ <GuidAttribute("F4D15099-3407-4A7E-A607-DEA440CF3891")> _ Public Class MyAppDomainManager Inherits AppDomainManager Private mySecurityManager As HostSecurityManager = Nothing Public Sub New() Console.WriteLine(" My AppDomain Manager ") mySecurityManager = AppDomain.CurrentDomain.CreateInstanceAndUnwrap( _ "CustomSecurityManager, Version=1.0.0.3, Culture=neutral, " & _ "PublicKeyToken=5659fc598c2a503e", "MyNamespace.MySecurityManager") Console.WriteLine(" Custom Security Manager Created.") End Sub 'New Public Overrides Sub InitializeNewDomain(ByVal appDomainInfo _ As AppDomainSetup) Console.Write("Initialize new domain called: ") Console.WriteLine(AppDomain.CurrentDomain.FriendlyName) InitializationFlags = _ AppDomainManagerInitializationOptions.RegisterWithHost End Sub 'InitializeNewDomain Public Overrides ReadOnly Property HostSecurityManager() _ As HostSecurityManager Get Return mySecurityManager End Get End Property End Class 'MyAppDomainManager
// To replace the default AppDomainManager, identify the // replacement assembly and replacement type in the // APPDOMAIN_MANAGER_ASM and APPDOMAIN_MANAGER_TYPE // environment variables. For example: // set APPDOMAIN_MANAGER_TYPE=library.TestAppDomainManager // set APPDOMAIN_MANAGER_ASM=library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f1368f7b12a08d72 using System; using System.Collections; using System.Net; using System.Reflection; using System.Security; using System.Security.Permissions; using System.Security.Policy; using System.Security.Principal; using System.Threading; using System.Runtime.InteropServices; [assembly: System.Security.AllowPartiallyTrustedCallersAttribute()] namespace MyNamespace { [GuidAttribute("F4D15099-3407-4A7E-A607-DEA440CF3891")] [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)] [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.Infrastructure)] public class MyAppDomainManager : AppDomainManager { private HostSecurityManager mySecurityManager = null; public MyAppDomainManager() { Console.WriteLine(" My AppDomain Manager "); mySecurityManager = AppDomain.CurrentDomain.CreateInstanceAndUnwrap( "CustomSecurityManager, Version=1.0.0.3, Culture=neutral, " + "PublicKeyToken=5659fc598c2a503e", "MyNamespace.MySecurityManager") as HostSecurityManager; Console.WriteLine(" Custom Security Manager Created."); } public override void InitializeNewDomain(AppDomainSetup appDomainInfo) { Console.Write("Initialize new domain called: "); Console.WriteLine(AppDomain.CurrentDomain.FriendlyName); InitializationFlags = AppDomainManagerInitializationOptions.RegisterWithHost; } public override HostSecurityManager HostSecurityManager { get { return mySecurityManager; } } } }


System.MarshalByRefObject
System.AppDomainManager


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AppDomainManager コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)


![]() |
---|
グローバル アセンブリ キャッシュ内のアセンブリのように FullTrust が与えられたアセンブリや、AppDomain.CreateDomain(String,Evidence,AppDomainSetup,PermissionSet,StrongName[]) メソッドで fullTrustAssemblies として識別できるアセンブリのみを、AppDomainManager コンストラクタおよび InitializeNewDomain メソッドに読み込むことができます。 |

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AppDomainManager プロパティ

名前 | 説明 | |
---|---|---|
![]() | ApplicationActivator | ドメインのアドインおよびマニフェストに基づくアプリケーションのアクティベーションを処理するアプリケーション アクティベータを取得します。 |
![]() | EntryAssembly | アプリケーションの入力アセンブリを取得します。 |
![]() | HostExecutionContextManager | 実行コンテキストのフローを管理する、ホスト実行コンテキスト マネージャを取得します。 |
![]() | HostSecurityManager | アプリケーション ドメインのセキュリティの決定に関与するホスト セキュリティ マネージャを取得します。 |
![]() | InitializationFlags | カスタム アプリケーション ドメイン マネージャの初期化フラグを取得します。 |

AppDomainManager メソッド

名前 | 説明 | |
---|---|---|
![]() | CreateDomain | アプリケーション ドメインを返します。このドメインは、新しいドメインまたは既存のドメインです。 |
![]() | CreateObjRef | リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 ( MarshalByRefObject から継承されます。) |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | InitializeLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。) |
![]() | InitializeNewDomain | 新しいアプリケーション ドメインを初期化します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | CreateDomainHelper | アプリケーション ドメインを作成するためのヘルパー メソッドを提供します。 |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |

AppDomainManager メンバ
アンマネージ ホストに対応するマネージ ホストを提供します。
AppDomainManager データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | ApplicationActivator | ドメインのアドインおよびマニフェストに基づくアプリケーションのアクティベーションを処理するアプリケーション アクティベータを取得します。 |
![]() | EntryAssembly | アプリケーションの入力アセンブリを取得します。 |
![]() | HostExecutionContextManager | 実行コンテキストのフローを管理する、ホスト実行コンテキスト マネージャを取得します。 |
![]() | HostSecurityManager | アプリケーション ドメインのセキュリティの決定に関与するホスト セキュリティ マネージャを取得します。 |
![]() | InitializationFlags | カスタム アプリケーション ドメイン マネージャの初期化フラグを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | CreateDomain | アプリケーション ドメインを返します。このドメインは、新しいドメインまたは既存のドメインです。 |
![]() | CreateObjRef | リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。) |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | InitializeLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。) |
![]() | InitializeNewDomain | 新しいアプリケーション ドメインを初期化します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | CreateDomainHelper | アプリケーション ドメインを作成するためのヘルパー メソッドを提供します。 |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |

- AppDomainManagerのページへのリンク