通过


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);

注解

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

如果不需要接收器功能,请将 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

适用于