IChannel.ChannelPriority Property

Gets the priority of the channel.

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

int ChannelPriority { get; }
/** @property */
int get_ChannelPriority ()

function get ChannelPriority () : int

Property Value

An integer that indicates the priority of the channel.

Exception typeCondition


The immediate caller does not have infrastructure permission.

Higher numbers indicate higher priority, so a channel with priority of 50 has a higher priority than a channel with priority 25. The cross application domain channel has a priority of 100.

Client channels with higher priority are given the first chance to connect to a remote object specified by a URL or a particular channel data entry from a ObjRef.

For server channels, the priority indicates the order in which their channel data will appear in a ObjRef, which in turn affects the order in which clients will try to connect to the server object. If the server is listening on an HTTP channel with priority 50 and a TCP channel with priority 25 and the client has registered both an HTTP and TCP channel, then the client will use the HTTP channel to talk to the server.

// Creating the 'IDictionary' to set the server object properties.
IDictionary myDictionary = new Hashtable();
// Set the properties along with the constructor.
HttpClientChannel myHttpClientChannel = 
      new HttpClientChannel(myDictionary,new BinaryClientFormatterSinkProvider());
// Register the server channel.
MyHelloServer myHelloServer1 = (MyHelloServer)Activator.GetObject(
typeof(MyHelloServer), "http://localhost:8085/SayHello");
if (myHelloServer1 == null)
   System.Console.WriteLine("Could not locate server");
   // Get the name of the channel.
   Console.WriteLine("Channel Name :"+myHttpClientChannel.ChannelName);
   // Get the channel priority.
   Console.WriteLine("ChannelPriority :"+myHttpClientChannel.ChannelPriority.ToString());
   string myString,myObjectURI1;
   Console.WriteLine("Parse :" + 
       myHttpClientChannel.Parse("http://localhost:8085/SayHello",out myString)+myString);
   // Get the key count.
   System.Console.WriteLine("Keys.Count : " + myHttpClientChannel.Keys.Count);
   // Get the channel message sink that delivers message to the specified url.
   IMessageSink myIMessageSink = 
                                                                   null,out myObjectURI1);
   Console.WriteLine("The channel message sink that delivers the messages to the URL is : "
   Console.WriteLine("URI of the new channel message sink is: " +myObjectURI1);

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions