IChannel.ChannelPriority Property

Gets the priority of the channel.

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

int ChannelPriority { get; }

Property Value

Type: System.Int32
An integer that indicates the priority of the channel.


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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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