ChannelServices.GetChannel(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回具有指定名稱的已登錄通道。
public:
static System::Runtime::Remoting::Channels::IChannel ^ GetChannel(System::String ^ name);
public static System.Runtime.Remoting.Channels.IChannel GetChannel (string name);
[System.Security.SecurityCritical]
public static System.Runtime.Remoting.Channels.IChannel GetChannel (string name);
static member GetChannel : string -> System.Runtime.Remoting.Channels.IChannel
[<System.Security.SecurityCritical>]
static member GetChannel : string -> System.Runtime.Remoting.Channels.IChannel
Public Shared Function GetChannel (name As String) As IChannel
參數
- name
- String
通道名稱。
傳回
已登錄通道的介面;如果通道沒有登錄,則為 null
。
- 屬性
例外狀況
立即呼叫端沒有基礎結構使用權限。
範例
HttpChannel^ myClientChannel = gcnew HttpChannel( myProperties,gcnew SoapClientFormatterSinkProvider,gcnew SoapServerFormatterSinkProvider );
ChannelServices::RegisterChannel( myClientChannel, false );
// Get the registered channel.
Console::WriteLine( "Channel Name : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelName );
Console::WriteLine( "Channel Priorty : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelPriority );
HttpChannel myClientChannel = new HttpChannel(myProperties,
new SoapClientFormatterSinkProvider(),
new SoapServerFormatterSinkProvider());
ChannelServices.RegisterChannel(myClientChannel);
// Get the registered channel.
Console.WriteLine("Channel Name : "+ChannelServices.GetChannel(
myClientChannel.ChannelName).ChannelName);
Console.WriteLine("Channel Priorty : "+ChannelServices.GetChannel(
myClientChannel.ChannelName).ChannelPriority);
Dim myClientChannel As New HttpChannel(myProperties, New SoapClientFormatterSinkProvider(), _
New SoapServerFormatterSinkProvider())
ChannelServices.RegisterChannel(myClientChannel)
' Get the registered channel.
Console.WriteLine("Channel Name : " + ChannelServices.GetChannel _
(myClientChannel.ChannelName).ChannelName)
Console.WriteLine("Channel Priorty : " + _
ChannelServices.GetChannel(myClientChannel.ChannelName).ChannelPriority.ToString())