HttpServerChannel 建構函式

定義

初始化 HttpServerChannel 類別的新執行個體。

多載

HttpServerChannel()

初始化 HttpServerChannel 類別的新執行個體。

HttpServerChannel(Int32)

初始化 HttpServerChannel 類別的新執行個體,這個執行個體包含指定的設計工具。

HttpServerChannel(IDictionary, IServerChannelSinkProvider)

使用指定的通道屬性和接收,初始化 HttpServerChannel 類別的新執行個體。

HttpServerChannel(String, Int32)

使用指定的名稱和會接聽指定的連接埠,初始化 HttpServerChannel 類別的新執行個體。

HttpServerChannel(String, Int32, IServerChannelSinkProvider)

在指定的連接埠上使用指定的名稱,初始化 HttpServerChannel 類別的新執行個體,其會接聽指定的連接埠,並使用指定的接收 (Sink)。

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 類別的新執行個體,其會接聽指定的連接埠,並使用指定的接收 (Sink)。

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

備註

這個建構函式會 ChannelName 使用 name 參數來設定 屬性。

若要要求動態指派可用的埠,請將 port 參數設定為0 (零) 。

如果您不需要接收功能,請將 sinkProvider 參數設定為 null

適用於