ChannelServices.GetChannel Method (String)

 

Returns a registered channel with the specified name.

Namespace:   System.Runtime.Remoting.Channels
Assembly:  mscorlib (in mscorlib.dll)

[SecurityCriticalAttribute]
public static IChannel GetChannel(
	string name
)

Parameters

name
Type: System.String

The channel name.

Return Value

Type: System.Runtime.Remoting.Channels.IChannel

An interface to a registered channel, or null if the channel is not registered.

Exception Condition
SecurityException

The immediate caller does not have infrastructure permission.

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

SecurityPermission

For operating with infrastructure code. Demand value: SecurityAction.LinkDemand; Permission value: SecurityPermissionFlag.Infrastructure

.NET Framework
Available since 1.1
Return to top
Show: