ChannelServices.RegisterChannel ChannelServices.RegisterChannel ChannelServices.RegisterChannel ChannelServices.RegisterChannel Method

Definition

Overloads

RegisterChannel(IChannel) RegisterChannel(IChannel) RegisterChannel(IChannel) RegisterChannel(IChannel)

Registers a channel with the channel services. RegisterChannel(IChannel) is obsolete. Please use RegisterChannel(IChannel, Boolean) instead.

RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean)

Registers a channel with the channel services.

RegisterChannel(IChannel) RegisterChannel(IChannel) RegisterChannel(IChannel) RegisterChannel(IChannel)

Warning

This API is now obsolete.

Registers a channel with the channel services. RegisterChannel(IChannel) is obsolete. Please use RegisterChannel(IChannel, Boolean) instead.

public:
 static void RegisterChannel(System::Runtime::Remoting::Channels::IChannel ^ chnl);
[System.Obsolete("Use RegisterChannel(IChannel,Boolean)")]
[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
Public Shared Sub RegisterChannel (chnl As IChannel)
Parameters
chnl
IChannel IChannel IChannel IChannel

The channel to register.

Exceptions

The channel has already been registered.

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

Examples

HttpChannel^ channel = gcnew HttpChannel( 9000 );
ChannelServices::RegisterChannel( channel, false );
RemotingConfiguration::RegisterWellKnownServiceType( SampleNamespace::SampleService::typeid, "MySampleService/SampleService::soap", WellKnownObjectMode::Singleton );
Console::WriteLine( "** Press enter to end the server process. **" );
Console::ReadLine();
      HttpChannel channel = new HttpChannel(9000);
      ChannelServices.RegisterChannel(channel);

      RemotingConfiguration.RegisterWellKnownServiceType( typeof(SampleService), 
"MySampleService/SampleService.soap", WellKnownObjectMode.Singleton);
      
      Console.WriteLine("** Press enter to end the server process. **");
      Console.ReadLine();
Dim channel As New HttpChannel(9000)
ChannelServices.RegisterChannel(channel)
RemotingConfiguration.RegisterWellKnownServiceType(GetType(SampleService), "MySampleService/SampleService.soap", WellKnownObjectMode.Singleton)

Console.WriteLine("** Press enter to end the server process. **")
Console.ReadLine()

Remarks

Note

RegisterChannel(IChannel) is obsolete. Please use RegisterChannel(IChannel, Boolean) instead.

The RegisterChannel method takes in 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 HttpChannel, and <channel> Element (Template).

Security

SecurityPermission
For configuration of the remoting infrastructure. Demand value: Demand; Permission value: RemotingConfiguration

RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean) RegisterChannel(IChannel, Boolean)

Registers a channel with the channel services.

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)
Parameters
chnl
IChannel IChannel IChannel IChannel

The channel to register.

ensureSecurity
Boolean Boolean Boolean 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.

Exceptions

The channel has already been registered.

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

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. 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 <channel> Element (Template).

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.

Note

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

Security

SecurityPermission
For configuration of the remoting infrastructure. Demand value: Demand; Permission value: RemotingConfiguration

Applies to