Export (0) Print
Expand All

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, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

© 2015 Microsoft