ChannelServices.RegisterChannel メソッド
チャネル サービスを備えたチャネルを登録します。
Public Shared Sub RegisterChannel( _
ByVal chnl As IChannel _)
[C#]
public static void RegisterChannel(IChannelchnl);
[C++]
public: static void RegisterChannel(IChannel* chnl);
[JScript]
public static function RegisterChannel(
chnl : IChannel);
パラメータ
- chnl
登録するチャネル。
例外
例外の種類 | 条件 |
---|---|
ArgumentNullException | chnl パラメータが null 参照 (Visual Basic では Nothing) です。 |
RemotingException | チャネルが既に登録されています。 |
SecurityException | コールスタックの上位にある 1 つ以上の呼び出し元に、リモート処理の型とチャネルを構成するためのアクセス許可がありません。 |
解説
RegisterChannel メソッドは、チャネル オブジェクトから IChannel インターフェイスを取得します。チャネルの ChannelName が一意であるか、チャネルが匿名である必要があります。 IChannel.ChannelName が name 構成プロパティを使用して null 参照 (Visual Basic では Nothing) または Empty に設定されている場合、チャネルは匿名になります。
メモ AppDomain 内に同じ名前で 2 つのチャネルは登録できません。既定では、 HttpChannel の名前は "http"、 TcpChannel の名前は "tcp" です。したがって、同じ種類の 2 つのチャネルを登録する場合は、構成プロパティを使用して一方に異なる名前を付ける必要があります。
チャネル構成プロパティの詳細については、 HttpChannel のトピックと「 <channel> 要素 (テンプレート) 」を参照してください。
使用例
Dim channel As New HttpChannel(9000)
ChannelServices.RegisterChannel(channel)
RemotingConfiguration.RegisterWellKnownServiceType(GetType(SampleService), "MySampleService/SampleService.soap", WellKnownObjectMode.Singleton)
Console.WriteLine("** Press enter to end the server process. **")
Console.ReadLine()
[C#]
HttpChannel channel = new HttpChannel(9000);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType( typeof(SampleService),
"MySampleService/SampleService.soap", WellKnownObjectMode.Singleton);
Console.WriteLine("** Press enter to end the server process. **");
Console.ReadLine();
[C++]
HttpChannel* channel = new HttpChannel(9000);
ChannelServices::RegisterChannel(channel);
RemotingConfiguration::RegisterWellKnownServiceType(__typeof(SampleService),
S"MySampleService/SampleService::soap", WellKnownObjectMode::Singleton);
Console::WriteLine(S"** Press enter to end the server process. **");
Console::ReadLine();
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- SecurityPermission (リモート処理インフラストラクチャを構成するために必要なアクセス許可)要求値: SecurityAction.Demand; アクセス許可値: SecurityPermissionFlag.RemotingConfiguration
参照
ChannelServices クラス | ChannelServices メンバ | System.Runtime.Remoting.Channels 名前空間