ChannelServices.RegisterChannel Method (IChannel)

Note: This API is now obsolete.

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

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

[ObsoleteAttribute("Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.", 
	false)]
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
public static void RegisterChannel(
	IChannel chnl
)

Parameters

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

The channel to register.

ExceptionCondition
ArgumentNullException

The chnl parameter is null.

RemotingException

The channel has already been registered.

SecurityException

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

NoteNote

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 [<topic://gnconchanneltemplate>].

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

.NET Framework

Supported in: 1.1
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5
Obsolete (compiler warning) in 3.5 SP1
Obsolete (compiler warning) in 3.0
Obsolete (compiler warning) in 3.0 SP1
Obsolete (compiler warning) in 3.0 SP2
Obsolete (compiler warning) in 2.0
Obsolete (compiler warning) in 2.0 SP1
Obsolete (compiler warning) in 2.0 SP2

.NET Framework Client Profile

Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5 SP1

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