HttpServerChannel 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 HttpServerChannel 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| HttpServerChannel() |
初始化 HttpServerChannel 類別的新執行個體。 |
| HttpServerChannel(Int32) |
初始化一個在指定埠口監聽的類別新實例 HttpServerChannel 。 |
| HttpServerChannel(IDictionary, IServerChannelSinkProvider) |
初始化一個具有指定通道屬性與 sink 的類別新實例 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(0)。
適用於
HttpServerChannel(IDictionary, IServerChannelSinkProvider)
初始化一個具有指定通道屬性與 sink 的類別新實例 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
例外狀況
一個設定屬性格式錯誤。
範例
以下程式碼範例說明如何使用此建構子。
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(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(0)。
如果你不需要匯入功能,請將參數設 sinkProvider 為 null。