HttpServerChannel 构造函数

定义

初始化 HttpServerChannel 类的新实例。

重载

HttpServerChannel()

初始化 HttpServerChannel 类的新实例。

HttpServerChannel(Int32)

初始化在指定端口上侦听的 HttpServerChannel 类的新实例。

HttpServerChannel(IDictionary, IServerChannelSinkProvider)

使用指定的信道属性和接收器初始化 HttpServerChannel 类的新实例。

HttpServerChannel(String, Int32)

使用给定名称初始化 HttpServerChannel 类的新实例,该实例侦听指定的端口。

HttpServerChannel(String, Int32, IServerChannelSinkProvider)

在指定的端口以给定的名称初始化 HttpServerChannel 类的新实例,该实例侦听指定的端口并使用指定的接收器。

HttpServerChannel()

初始化 HttpServerChannel 类的新实例。

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

适用于

HttpServerChannel(Int32)

初始化在指定端口上侦听的 HttpServerChannel 类的新实例。

public:
 HttpServerChannel(int port);
public HttpServerChannel (int port);
new System.Runtime.Remoting.Channels.Http.HttpServerChannel : int -> System.Runtime.Remoting.Channels.Http.HttpServerChannel
Public Sub New (port As Integer)

参数

port
Int32

信道侦听的端口。

注解

若要请求动态分配可用端口,请将 port 参数设置为 0 (零) 。

适用于

HttpServerChannel(IDictionary, IServerChannelSinkProvider)

使用指定的信道属性和接收器初始化 HttpServerChannel 类的新实例。

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

参数

properties
IDictionary

包含当前信道配置信息的信道属性的 IDictionary

sinkProvider
IServerChannelSinkProvider

要用于 IServerChannelSinkProvider 的新实例的 HttpServerChannel

例外

配置属性的格式设置不正确。

示例

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

System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable;
properties->default[ L"port" ] = 9090;
IServerChannelSinkProvider^ sinkProvider = nullptr;
HttpServerChannel^ serverChannel = gcnew HttpServerChannel( properties,sinkProvider );
System.Collections.Hashtable properties =
    new System.Collections.Hashtable();
properties["port"] = 9090;
IServerChannelSinkProvider sinkProvider = null;
HttpServerChannel serverChannel = new HttpServerChannel(
    properties, sinkProvider);

注解

有关通道配置属性的详细信息,请参阅 通道和格式化程序配置属性

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

另请参阅

适用于

HttpServerChannel(String, Int32)

使用给定名称初始化 HttpServerChannel 类的新实例,该实例侦听指定的端口。

public:
 HttpServerChannel(System::String ^ name, int port);
public HttpServerChannel (string name, int port);
new System.Runtime.Remoting.Channels.Http.HttpServerChannel : string * int -> System.Runtime.Remoting.Channels.Http.HttpServerChannel
Public Sub New (name As String, port As Integer)

参数

name
String

信道的名称。

port
Int32

信道侦听的端口。

示例

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

String^ name = L"RemotingServer";
int port = 9090;
HttpServerChannel^ serverChannel = gcnew HttpServerChannel( name,port );
string name = "RemotingServer";
int port = 9090;
HttpServerChannel serverChannel =
    new HttpServerChannel(name, port);

注解

此构造函数使用 name 参数设置 ChannelName 属性。 如果要注册多个通道,则每个通道必须具有唯一的名称。

若要请求动态分配可用端口,请将 port 参数设置为 0 (零) 。

适用于

HttpServerChannel(String, Int32, IServerChannelSinkProvider)

在指定的端口以给定的名称初始化 HttpServerChannel 类的新实例,该实例侦听指定的端口并使用指定的接收器。

public:
 HttpServerChannel(System::String ^ name, int port, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ sinkProvider);
public HttpServerChannel (string name, int port, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Http.HttpServerChannel : string * int * System.Runtime.Remoting.Channels.IServerChannelSinkProvider -> System.Runtime.Remoting.Channels.Http.HttpServerChannel
Public Sub New (name As String, port As Integer, sinkProvider As IServerChannelSinkProvider)

参数

name
String

信道的名称。

port
Int32

信道侦听的端口。

sinkProvider
IServerChannelSinkProvider

要由信道使用的 IServerChannelSinkProvider

示例

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

String^ name = L"RemotingServer";
int port = 9090;
IServerChannelSinkProvider^ sinkProvider = nullptr;
HttpServerChannel^ serverChannel = gcnew HttpServerChannel(
   name,port,sinkProvider );
string name = "RemotingServer";
int port = 9090;
IServerChannelSinkProvider sinkProvider = null;
HttpServerChannel serverChannel =
    new HttpServerChannel(name, port, sinkProvider);

注解

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

若要请求动态分配可用端口,请将 port 参数设置为 0 (零) 。

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

适用于