This documentation is archived and is not being maintained.

ReliableSessionBindingElement Class

Represents the binding element that can produce the sending and receiving channels required for a reliable session between endpoints.


Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public sealed class ReliableSessionBindingElement : BindingElement, 

The ReliableSessionBindingElement type exposes the following members.

Public methodReliableSessionBindingElement()Initializes a new instance of the ReliableSessionBindingElement class.
Public methodReliableSessionBindingElement(Boolean)Initializes a new instance of the ReliableSessionBindingElement class that specifies whether message delivery must preserve the order in which messages are sent.

Public propertyAcknowledgementIntervalGets or sets the interval of time that a destination waits before sending an acknowledgment to the message source on reliable channels that are created by the factory.
Public propertyFlowControlEnabledGets or sets a value that indicates whether the reliable session has flow control enabled.
Public propertyInactivityTimeoutGets or sets an interval of time that a service remains inactive before closing.
Public propertyMaxPendingChannelsGets or sets the largest number of channels that can be pending during the reliable session.
Public propertyMaxRetryCountGets or sets the maximum number of times that a message attempts to be transferred during the reliable session.
Public propertyMaxTransferWindowSizeGets or sets the largest number of messages that can exist in either the send buffer or the receive buffer.
Public propertyOrderedGets or sets a value that indicates whether message delivery must preserve the order in which messages are sent.
Public propertyReliableMessagingVersionGets or sets the version of WS-ReliableMessaging specified by the binding element.

Public methodBuildChannelFactory<TChannel>Returns a factory that creates a channel of a specified type that supports a reliable session. (Overrides BindingElement.BuildChannelFactory<TChannel>(BindingContext).)
Public methodBuildChannelListener<TChannel>Returns a listener that accepts a channel of a specified type that supports a reliable session. (Overrides BindingElement.BuildChannelListener<TChannel>(BindingContext).)
Public methodCanBuildChannelFactory<TChannel>Returns a value that indicates whether the channel factory can be built for the channel and context provided that can support a reliable session. (Overrides BindingElement.CanBuildChannelFactory<TChannel>(BindingContext).)
Public methodCanBuildChannelListener<TChannel>Returns a value that indicates whether the channel listener can be built for the channel and context provided that can support a reliable session. (Overrides BindingElement.CanBuildChannelListener<TChannel>(BindingContext).)
Public methodCloneCreates a copy of the current reliable session binding element. (Overrides BindingElement.Clone().)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetProperty<T>Gets a property of the specified type from its binding context. (Overrides BindingElement.GetProperty<T>(BindingContext).)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Explicit interface implemetationPrivate methodIPolicyExportExtension.ExportPolicyMaps the information contained in the reliable session binding element into the WSDL elements that enable a remote endpoint to access the service with a reliable session.

Provides sessions and optionally provides ordered message delivery. This implemented session can cross SOAP and transport intermediaries.

Each binding element represents a processing step when sending or receiving messages. At runtime, binding elements create the channel factories and listeners that are necessary to build outgoing and incoming channel stacks required to send and receive messages. The ReliableSessionBindingElement provides an optional layer in the stack that can establish a reliable session between endpoints and configure the behavior of this session.

The ReliableSessionBindingElement is provided on the standard bindings in the following table.








On (required)

The ReliableSessionBindingElement can be added to any custom binding. This is done using the following configuration elements.

        <binding configurationName=”ReliabilityHTTP”>

The following sample code demonstrates how to use ReliableSessionBindingElement in code.

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
    // Create a custom binding that contains two binding elements.
    ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
    reliableSession.Ordered = true;

    HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
    httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
    httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

    CustomBinding binding = new CustomBinding(reliableSession, httpTransport);

    // Add an endpoint using that binding.
    serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, "");

    // Add a MEX endpoint.
    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;
    smb.HttpGetUrl = new Uri("http://localhost:8001/servicemodelsamples");

    // Open the ServiceHostBase to create listeners and start listening for messages.

    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");

    // Close the ServiceHostBase to shutdown the service.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, 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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.