ChannelServices.RegisterChannel 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| RegisterChannel(IChannel) |
已淘汰.
向頻道服務註冊一個頻道。 RegisterChannel(IChannel) 已經過時。 請改用 RegisterChannel(IChannel, Boolean)。 |
| RegisterChannel(IChannel, Boolean) |
向頻道服務註冊一個頻道。 |
RegisterChannel(IChannel)
警告
Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.
向頻道服務註冊一個頻道。 RegisterChannel(IChannel) 已經過時。 請改用 RegisterChannel(IChannel, Boolean)。
public:
static void RegisterChannel(System::Runtime::Remoting::Channels::IChannel ^ chnl);
public static void RegisterChannel(System.Runtime.Remoting.Channels.IChannel chnl);
[System.Obsolete("Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.", false)]
public static void RegisterChannel(System.Runtime.Remoting.Channels.IChannel chnl);
static member RegisterChannel : System.Runtime.Remoting.Channels.IChannel -> unit
[<System.Obsolete("Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.", false)>]
static member RegisterChannel : System.Runtime.Remoting.Channels.IChannel -> unit
Public Shared Sub RegisterChannel (chnl As IChannel)
參數
- chnl
- IChannel
註冊頻道。
- 屬性
例外狀況
參數 chnl 為 null。
該頻道已經註冊。
呼叫堆疊中至少有一個呼叫者沒有權限設定遠端存取類型和通道。
備註
Note
RegisterChannel(IChannel) 已經過時。 請改用 RegisterChannel(IChannel, Boolean)。
此方法從 RegisterChannel 通道物件接收 IChannel 介面。
ChannelName頻道必須是獨一無二的,或者頻道必須是匿名的。 若IChannel.ChannelName該通道被設定為或nullEmpty,則該通道是匿名的,且該通道是利用name配置特性設定的。
你不能在 AppDomain. 預設情況下,a HttpChannel 的名稱是「http」,a 的 TcpChannel 名稱是「tcp」。因此,如果你想註冊兩個相同類型的通道,必須透過設定屬性為其中一個指定不同的名稱。
欲了解更多頻道配置屬性,請參閱 HttpChannel及<頻道>元素(範本)。
適用於
RegisterChannel(IChannel, Boolean)
向頻道服務註冊一個頻道。
public:
static void RegisterChannel(System::Runtime::Remoting::Channels::IChannel ^ chnl, bool ensureSecurity);
public static void RegisterChannel(System.Runtime.Remoting.Channels.IChannel chnl, bool ensureSecurity);
static member RegisterChannel : System.Runtime.Remoting.Channels.IChannel * bool -> unit
Public Shared Sub RegisterChannel (chnl As IChannel, ensureSecurity As Boolean)
參數
- chnl
- IChannel
註冊頻道。
- ensureSecurity
- Boolean
true 確保安全性已啟用;否則 false。 將 該值設為 false 不會影響 TCP 或 IPC 通道的安全設定。
例外狀況
參數 chnl 為 null。
該頻道已經註冊。
呼叫堆疊中至少有一個呼叫者沒有權限設定遠端通訊類型和通道。
不支援。HttpServerChannel 若您需要安全的 HTTP 通道,請使用 Internet Information Services(IIS)來架設服務。
備註
該RegisterChannel(IChannel, Boolean)方法從通道物件接收介面。IChannel
ChannelName頻道必須是獨一無二的,或者頻道必須是匿名的。 若IChannel.ChannelName該通道被設定為或nullEmpty,則該通道是匿名的,且該通道是利用name配置特性設定的。
你不能在 AppDomain. 預設情況下,a HttpChannel 的名稱是「http」,a TcpChannel 的名稱是「tcp」。 因此,如果你想註冊兩個相同類型的通道,必須透過設定屬性為其中一個指定不同的名稱。
欲了解更多通道配置屬性,請參閱通道與格式配置屬性及<通道>元素(模板)。
若 ensureSecurity 參數設為 true,遠端系統會判斷通道是否實 ISecurableChannel作 ,若實作,則啟用加密與數位簽章。 若通道未實作 ISecurableChannel,則會拋出例外。
Note
設定 ensureSecurity 為 會 true 讓該頻道在所有平台上出現 a RemotingExceptionHttpServerChannel 。 如果你想使用安全的 HTTP 通道,必須在 IIS 中架設服務。