ChannelFactory<TChannel> コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| ChannelFactory<TChannel>() |
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(Binding) |
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(ServiceEndpoint) |
指定したエンドポイントを持つチャネルを生成する ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(String) |
指定したエンドポイント構成名を使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(Type) |
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(Binding, EndpointAddress) |
指定したバインディングとエンドポイント アドレスを使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(Binding, String) |
指定したバインディングとリモート アドレスを使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
| ChannelFactory<TChannel>(String, EndpointAddress) |
エンドポイント構成とリモート アドレスの指定した名前に関連付けられている ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。 |
ChannelFactory<TChannel>()
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory();
public ChannelFactory();
Public Sub New ()
例
この例では、ChannelFactory<TChannel> インターフェイスを使用して、IRequestChannel クラスの新しいオブジェクトを作成する方法を示します。
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint", address);
適用対象
ChannelFactory<TChannel>(Binding)
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::ServiceModel::Channels::Binding ^ binding);
public ChannelFactory(System.ServiceModel.Channels.Binding binding);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (binding As Binding)
パラメーター
注釈
アプリケーション構成ファイルを使用するのではなく、プログラムでバインディング情報を渡す場合は、このコンストラクターを使用します。
適用対象
ChannelFactory<TChannel>(ServiceEndpoint)
指定したエンドポイントを持つチャネルを生成する ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::ServiceModel::Description::ServiceEndpoint ^ endpoint);
public ChannelFactory(System.ServiceModel.Description.ServiceEndpoint endpoint);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Description.ServiceEndpoint -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpoint As ServiceEndpoint)
パラメーター
- endpoint
- ServiceEndpoint
工場で生産されるチャネルの ServiceEndpoint 。
例外
endpoint は null です。
例
ContractDescription contract = new ContractDescription("MyContract");
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
BasicHttpBinding binding = new BasicHttpBinding();
ServiceEndpoint endpoint = new ServiceEndpoint(contract, binding, address);
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(endpoint);
注釈
アプリケーション構成ファイルを使用するのではなく、サービス エンドポイント情報をプログラムで渡す場合は、このコンストラクターを使用します。
適用対象
ChannelFactory<TChannel>(String)
指定したエンドポイント構成名を使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::String ^ endpointConfigurationName);
public ChannelFactory(string endpointConfigurationName);
new System.ServiceModel.ChannelFactory<'Channel> : string -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpointConfigurationName As String)
パラメーター
- endpointConfigurationName
- String
エンドポイントに使用される構成名。
例外
endpointConfigurationName は nullです。
例
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint");
注釈
アプリケーション構成ファイルに複数のターゲット エンドポイントがある場合は、このコンストラクターを使用します。
適用対象
ChannelFactory<TChannel>(Type)
ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
protected:
ChannelFactory(Type ^ channelType);
protected ChannelFactory(Type channelType);
new System.ServiceModel.ChannelFactory<'Channel> : Type -> System.ServiceModel.ChannelFactory<'Channel>
Protected Sub New (channelType As Type)
パラメーター
例外
channelType は null です。
channelTypeはクラスまたは値型であり、インターフェイスではありません。
注釈
アプリケーション構成ファイルを使用するのではなく、プログラムでチャネルの種類の情報を渡す場合は、このコンストラクターを使用します。
channelType パラメーターはインターフェイスである必要があります。
適用対象
ChannelFactory<TChannel>(Binding, EndpointAddress)
指定したバインディングとエンドポイント アドレスを使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ remoteAddress);
public ChannelFactory(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (binding As Binding, remoteAddress As EndpointAddress)
パラメーター
- remoteAddress
- EndpointAddress
サービスの場所を提供する EndpointAddress 。
例外
binding は null です。
例
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(binding, address);
注釈
このコンストラクターは、アプリケーション構成ファイルを使用するのではなく、バインディング情報とアドレス情報をプログラムで渡す場合に使用します。
適用対象
ChannelFactory<TChannel>(Binding, String)
指定したバインディングとリモート アドレスを使用して、 ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::ServiceModel::Channels::Binding ^ binding, System::String ^ remoteAddress);
public ChannelFactory(System.ServiceModel.Channels.Binding binding, string remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : System.ServiceModel.Channels.Binding * string -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (binding As Binding, remoteAddress As String)
パラメーター
- remoteAddress
- String
サービスの場所を提供するアドレス。
例外
remoteAddress は nullです。
例
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
Uri via = new Uri("http://localhost:8000/Via");
ChannelFactory<IRequestChannel> factory =
new ChannelFactory<IRequestChannel>(binding, "http://fsHost/fs/endp");
IRequestChannel channel = factory.CreateChannel(address, via);
channel.Open();
Message request = Message.CreateMessage(MessageVersion.Soap11, "hello");
Message reply = channel.Request(request);
Console.Out.WriteLine(reply.Headers.Action);
reply.Close();
channel.Close();
factory.Close();
注釈
リモート アドレス情報に関する情報を型指定されたオブジェクトとしてではなく文字列で渡す場合は、このコンストラクターを使用します。
適用対象
ChannelFactory<TChannel>(String, EndpointAddress)
エンドポイント構成とリモート アドレスの指定した名前に関連付けられている ChannelFactory<TChannel> クラスの新しいインスタンスを初期化します。
public:
ChannelFactory(System::String ^ endpointConfigurationName, System::ServiceModel::EndpointAddress ^ remoteAddress);
public ChannelFactory(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ChannelFactory<'Channel> : string * System.ServiceModel.EndpointAddress -> System.ServiceModel.ChannelFactory<'Channel>
Public Sub New (endpointConfigurationName As String, remoteAddress As EndpointAddress)
パラメーター
- endpointConfigurationName
- String
エンドポイントに使用される構成名。
- remoteAddress
- EndpointAddress
サービスの場所を提供する EndpointAddress 。
例外
endpointConfigurationName または remoteAddress が null。
例
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>("MyEndpoint", address);