ChannelServices.RegisterChannel Method (IChannel, Boolean)

Registers a channel with the channel services.

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

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
public static void RegisterChannel(
	IChannel chnl,
	bool ensureSecurity
)

Parameters

chnl
Type: System.Runtime.Remoting.Channels.IChannel

The channel to register.

ensureSecurity
Type: System.Boolean

true ensures that security is enabled; otherwise false. Setting the value to false does not effect the security setting on the TCP or IPC channel.

ExceptionCondition
ArgumentNullException

The chnl parameter is null.

RemotingException

The channel has already been registered.

SecurityException

At least one of the callers higher in the call stack does not have permission to configure remoting types and channels.

NotSupportedException

Not supported in Windows 98 for TcpServerChannel and on all platforms for HttpServerChannel. Host the service using Internet Information Services (IIS) if you require a secure HTTP channel.

The RegisterChannel(IChannel, Boolean) method receives the IChannel interface from a channel object. The channel's ChannelName must be unique, or the channel must be anonymous. A channel is anonymous if the IChannel.ChannelName is set to either null or Empty by using the name configuration property.

You cannot register two channels with the same name in a AppDomain. By default, the name of a HttpChannel is "http" and the name of a TcpChannel is "tcp". Therefore, if you want to register two channels of the same type, you must specify a different name for one of them through configuration properties.

For more information about channel configuration properties, see Channel and Formatter Configuration Properties and [<topic://gnconchanneltemplate>].

If the ensureSecurity parameter is set to true, the remoting system determines whether the channel implements ISecurableChannel, and if so, enables encryption and digital signatures. An exception is thrown if the channel does not implement ISecurableChannel.

NoteNote

Setting ensureSecurity to true throws a RemotingException for the TcpServerChannel on Windows 98 (Since secure tcp channels are not supported on Windows 9x), and for the HttpServerChannel on all platforms (You must host your service in IIS if you want to use a secure http channel).

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft