AppDomainManager クラス

定義

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

public ref class AppDomainManager : MarshalByRefObject
[System.Runtime.InteropServices.ComVisible(true)]
public class AppDomainManager : MarshalByRefObject
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public class AppDomainManager : MarshalByRefObject
[<System.Runtime.InteropServices.ComVisible(true)>]
type AppDomainManager = class
    inherit MarshalByRefObject
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
type AppDomainManager = class
    inherit MarshalByRefObject
Public Class AppDomainManager
Inherits MarshalByRefObject
継承
AppDomainManager
属性

次の例は、 の非常に単純な実装を 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

using System;
using System.Collections;
using System.Net;
using System.Reflection;
using System.Security;
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")]
    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;
            }
        }
    }
}
' 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.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
    
    Public Overrides Sub InitializeNewDomain(ByVal appDomainInfo _
        As AppDomainSetup) 
        Console.Write("Initialize new domain called:  ")
        Console.WriteLine(AppDomain.CurrentDomain.FriendlyName)
        InitializationFlags = _
            AppDomainManagerInitializationOptions.RegisterWithHost   
    End Sub

    Public Overrides ReadOnly Property HostSecurityManager() _
        As HostSecurityManager 
        Get
            Return mySecurityManager
        End Get
    End Property
End Class

注釈

重要

を使用 AppDomainManager して、ASP.NET でアプリケーション ドメインを構成しないでください。 ASP.NET では、構成はホストによって処理される必要があります。

クラスを AppDomainManager 実装すると、ホスティング アプリケーションが新しいアプリケーション ドメインの作成に参加できるようになります。 既定AppDomainManagerの を置き換えるには、APPDOMAIN_MANAGER_ASMおよびAPPDOMAIN_MANAGER_TYPE環境変数で置換AppDomainManagerのアセンブリと型を識別するか、構成ファイルで appDomainManagerAssembly> 要素と appDomainManagerType 要素を使用<します。>< アセンブリは完全に信頼されていて、グローバル アセンブリ キャッシュまたは開始アプリケーションのディレクトリに含まれている必要があります。 型名とアセンブリ名は、環境変数で完全修飾されている必要があります。 次に例を示します。

set APPDOMAIN_MANAGER_TYPE=MyNamespace.TestAppDomainManager

set APPDOMAIN_MANAGER_ASM=customappDomainmanager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f1368f7b12a08d72

重要

サブクラスAppDomainManagerを含むアセンブリが、条件 AllowPartiallyTrustedCallersAttribute (APTCA) 属性でマークされているアセンブリに依存する場合は、アプリケーション ドメインの作成に使用する の AppDomainSetup プロパティにPartialTrustVisibleAssemblies渡すアセンブリをリストに含める必要があります。 それ以外の場合、条件 APTCA 属性でマークされたアセンブリは無効になります。

AppDomainManagerは、アンマネージド ホストと同等のマネージド です。 オブジェクトは AppDomainManager 、プロセス内の新しいアプリケーション ドメインの作成に参加し、他のマネージド コードを実行する前に新しい AppDomain アプリケーション ドメインをカスタマイズできます。 AppDomainManagerでは、共通言語ランタイム実行の他の側面に参加するホスト マネージャーを提供することもできます。 たとえば、 は AppDomainManager 、アプリケーション ドメインの HostSecurityManager セキュリティ上の決定に関与するオブジェクトを識別できます。

Note

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

Note

このクラスには、クラス レベルのリンク要求と継承要求が含まれます。 SecurityExceptionは、直接の呼び出し元または派生クラスにインフラストラクチャアクセス許可がない場合にスローされます。 セキュリティ要求の詳細については、「 リンク要求継承要求」を参照してください。

コンストラクター

AppDomainManager()

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

プロパティ

ApplicationActivator

ドメインのアドインおよびマニフェストに基づくアプリケーションのアクティベーションを処理するアプリケーション アクティベーターを取得します。

EntryAssembly

アプリケーションの入力アセンブリを取得します。

HostExecutionContextManager

実行コンテキストのフローを管理する、ホスト実行コンテキスト マネージャーを取得します。

HostSecurityManager

アプリケーション ドメインのセキュリティの決定に関与するホスト セキュリティ マネージャーを取得します。

InitializationFlags

カスタム アプリケーション ドメイン マネージャーの初期化フラグを取得します。

メソッド

CheckSecuritySettings(SecurityState)

指定した操作がアプリケーション ドメイン内で許可されているかどうかを示します。

CreateDomain(String, Evidence, AppDomainSetup)

新規または既存のアプリケーション ドメインを返します。

CreateDomainHelper(String, Evidence, AppDomainSetup)

アプリケーション ドメインを作成するためのヘルパー メソッドを提供します。

CreateObjRef(Type)

リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。

(継承元 MarshalByRefObject)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetLifetimeService()
古い.

対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
InitializeLifetimeService()
古い.

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
InitializeNewDomain(AppDomainSetup)

新しいアプリケーション ドメインを初期化します。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。

(継承元 MarshalByRefObject)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象