AppDomainManagerとは? わかりやすく解説

AppDomainManager クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

アンマネージ ホストに対応するマネージ ホストを提供します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Class AppDomainManager
    Inherits MarshalByRefObject
Dim instance As AppDomainManager
[ComVisibleAttribute(true)] 
public class AppDomainManager : MarshalByRefObject
[ComVisibleAttribute(true)] 
public ref class AppDomainManager : public
 MarshalByRefObject
/** @attribute ComVisibleAttribute(true) */ 
public class AppDomainManager extends MarshalByRefObject
ComVisibleAttribute(true) 
public class AppDomainManager extends
 MarshalByRefObject
解説解説

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;
            }
        }
    }
}
.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.MarshalByRefObject
    System.AppDomainManager
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

AppDomainManager コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

AppDomainManager クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As New AppDomainManager
public AppDomainManager ()
public:
AppDomainManager ()
public AppDomainManager ()
public function AppDomainManager ()
解説解説
メモメモ

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

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AppDomainManager クラス
AppDomainManager メンバ
System 名前空間

AppDomainManager プロパティ


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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

AppDomainManager クラス
System 名前空間

AppDomainManager メンバ

アンマネージ ホストに対応するマネージ ホストを提供します。

AppDomainManager データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド AppDomainManager 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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

AppDomainManager クラス
System 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「AppDomainManager」の関連用語

AppDomainManagerのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AppDomainManagerのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS