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.

Exception Condition
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.

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

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

SecurityPermission

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

.NET Framework
Available since 1.1
Return to top
Show: