通过


HttpClientChannel 构造函数

定义

初始化 HttpClientChannel 类的新实例。

重载

名称 说明
HttpClientChannel()

初始化 HttpClientChannel 类的新实例。

HttpClientChannel(IDictionary, IClientChannelSinkProvider)

使用指定的配置属性和接收器初始化类的新实例 HttpClientChannel

HttpClientChannel(String, IClientChannelSinkProvider)

使用指定的名称和接收器初始化类的新实例 HttpClientChannel

HttpClientChannel()

初始化 HttpClientChannel 类的新实例。

public:
 HttpClientChannel();
public HttpClientChannel();
Public Sub New ()

注解

此构造函数返回的 HttpClientChannel 实例的配置属性都设置为其默认值。

适用于

HttpClientChannel(IDictionary, IClientChannelSinkProvider)

使用指定的配置属性和接收器初始化类的新实例 HttpClientChannel

public:
 HttpClientChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public HttpClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Http.HttpClientChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Http.HttpClientChannel
Public Sub New (properties As IDictionary, sinkProvider As IClientChannelSinkProvider)

参数

properties
IDictionary

一个 IDictionary 集合,指定通道要使用的配置属性的值。

sinkProvider
IClientChannelSinkProvider

通道 IClientChannelSinkProvider 要使用的实现。

例外

配置属性的格式不正确。

示例

下面的代码示例演示如何使用此构造函数。

// Create a client channel.
System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable;
properties->default[ L"port" ] = 9090;
IClientChannelSinkProvider^ sinkProvider = nullptr;
HttpClientChannel^ clientChannel = gcnew HttpClientChannel( properties,sinkProvider );
// Create a client channel.
System.Collections.Hashtable properties =
    new System.Collections.Hashtable();
properties["port"] = 9090;
IClientChannelSinkProvider sinkProvider = null;
HttpClientChannel clientChannel = new HttpClientChannel(
    properties, sinkProvider);

注解

有关通道配置属性的详细信息,请参阅 Channel 和 Formatter 配置属性

如果不需要接收器功能,请将 sinkProvider 参数设置为 null

另请参阅

适用于

HttpClientChannel(String, IClientChannelSinkProvider)

使用指定的名称和接收器初始化类的新实例 HttpClientChannel

public:
 HttpClientChannel(System::String ^ name, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public HttpClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Http.HttpClientChannel : string * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Http.HttpClientChannel
Public Sub New (name As String, sinkProvider As IClientChannelSinkProvider)

参数

name
String

新实例 HttpClientChannel的名称。

sinkProvider
IClientChannelSinkProvider

IClientChannelSinkProvider 供通道使用。

示例

下面的代码示例演示如何使用此构造函数。

// Create a client channel.
String^ name = L"RemotingClient";
IClientChannelSinkProvider^ sinkProvider = nullptr;
HttpClientChannel^ clientChannel = gcnew HttpClientChannel( name,sinkProvider );
// Create a client channel.
string name = "RemotingClient";
IClientChannelSinkProvider sinkProvider = null;
HttpClientChannel clientChannel = new HttpClientChannel(name,
    sinkProvider);

注解

此构造函数使用name参数设置ChannelName属性。

适用于