.NET Framework Class Library
ChannelServices..::.RegisterChannel Method (IChannel, Boolean)

Registers a channel with the channel services.

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

Visual Basic (Declaration)
<SecurityPermissionAttribute(SecurityAction.Demand, Flags := SecurityPermissionFlag.RemotingConfiguration)> _
Public Shared Sub RegisterChannel ( _
    chnl As IChannel, _
    ensureSecurity As Boolean _
)
Visual Basic (Usage)
Dim chnl As IChannel
Dim ensureSecurity As Boolean

ChannelServices.RegisterChannel(chnl, ensureSecurity)
C#
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
public static void RegisterChannel(
    IChannel chnl,
    bool ensureSecurity
)
Visual C++
[SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::RemotingConfiguration)]
public:
static void RegisterChannel(
    IChannel^ chnl, 
    bool ensureSecurity
)
JScript
public static function RegisterChannel(
    chnl : IChannel, 
    ensureSecurity : boolean
)

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 will not nullify the security setting done on the TCP or IPC channel. For details, see Remarks.
Exceptions

ExceptionCondition
ArgumentNullException

The chnl parameter is nullNothingnullptra null reference (Nothing in Visual Basic).

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.

Remarks

The RegisterChannel(IChannel, Boolean) method receives the IChannel interface from a channel object. Either 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 nullNothingnullptra null reference (Nothing in Visual Basic) 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  TcpServerChannel on win98 (Since secure tcp channel is not supported on wi9x)  , and for Http Server Channel on all platforms (Users need to host service in IIS if they want secure http channel).

.NET Framework Security

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0
See Also

Reference

Tags :


Page view tracker