方法 : プログラムを使用してチャネルを構成する
このトピックの対象は、既存のアプリケーションとの下位互換性のために残されているレガシ テクノロジに特定されています。新規の開発には、このトピックを適用しないでください。分散アプリケーションは、現在は Windows Communication Foundation (WCF) を使用して開発する必要があります。
このコード例では、サーバーのアプリケーション ドメインに対してプログラムでチャネルを構成する方法を示します。この例では、リモート処理システムが転送用に HttpChannel オブジェクトを使用し、シリアル化と逆シリアル化用に BinaryFormatter オブジェクトを使用することが、サーバーによって指定されています。
例
Dim props = New Hashtable() As IDictionary
props("name") = "ChannelName1"
Dim channel As New HttpChannel( _
props, _
Nothing, _
New BinaryServerFormatterSinkProvider() _
)
ChannelServices.RegisterChannel(channel)
IDictionary props = new Hashtable();
props["name"] = "MyHttpChannel";
HttpChannel channel = new HttpChannel(
props,
null,
new BinaryServerFormatterSinkProvider()
);
ChannelServices.RegisterChannel(channel);
参照
概念
ビルド日:2010-02-13