ReliableSessionBindingElement Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the binding element that can produce the sending and receiving channels required for a reliable session between endpoints.
public ref class ReliableSessionBindingElement sealed : System::ServiceModel::Channels::BindingElement
public ref class ReliableSessionBindingElement sealed : System::ServiceModel::Channels::BindingElement, System::ServiceModel::Description::IPolicyExportExtension
public sealed class ReliableSessionBindingElement : System.ServiceModel.Channels.BindingElement
public sealed class ReliableSessionBindingElement : System.ServiceModel.Channels.BindingElement, System.ServiceModel.Description.IPolicyExportExtension
type ReliableSessionBindingElement = class
inherit BindingElement
type ReliableSessionBindingElement = class
inherit BindingElement
interface IPolicyExportExtension
Public NotInheritable Class ReliableSessionBindingElement
Inherits BindingElement
Public NotInheritable Class ReliableSessionBindingElement
Inherits BindingElement
Implements IPolicyExportExtension
- Inheritance
- Implements
The ReliableSessionBindingElement can be added to any custom binding. This is done using the following configuration elements.
<bindings>
<customBinding>
<binding configurationName="ReliabilityHTTP">
<reliableSession/>
</binding>
</customBinding>
</bindings>
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");
serviceHost.Description.Behaviors.Add(smb);
// Open the ServiceHostBase to create listeners and start listening for messages.
serviceHost.Open();
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
// Close the ServiceHostBase to shutdown the service.
serviceHost.Close();
}
Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")
' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
' Create a custom binding that contains two binding elements.
Dim reliableSession As New ReliableSessionBindingElement()
reliableSession.Ordered = True
Dim httpTransport As New HttpTransportBindingElement()
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
Dim binding As New CustomBinding(reliableSession, httpTransport)
' Add an endpoint using that binding.
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, "")
' Add a MEX endpoint.
Dim smb As New ServiceMetadataBehavior()
smb.HttpGetEnabled = True
smb.HttpGetUrl = New Uri("http://localhost:8001/servicemodelsamples")
serviceHost.Description.Behaviors.Add(smb)
' Open the ServiceHostBase to create listeners and start listening for messages.
serviceHost.Open()
' The service can now be accessed.
Console.WriteLine("The service is ready.")
Console.WriteLine("Press <ENTER> to terminate service.")
Console.WriteLine()
Console.ReadLine()
' Close the ServiceHostBase to shutdown the service.
serviceHost.Close()
End Using
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.
Binding | Default |
---|---|
NetTcpBinding | Off |
WSHttpBinding | Off |
WSDualHttpBinding | On (required) |
Reliable |
Initializes a new instance of the ReliableSessionBindingElement class. |
Reliable |
Initializes a new instance of the ReliableSessionBindingElement class that specifies whether message delivery must preserve the order in which messages are sent. |
Acknowledgement |
Gets 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. |
Flow |
Gets or sets a value that indicates whether the reliable session has flow control enabled. |
Inactivity |
Gets or sets an interval of time that a service remains inactive before closing. |
Max |
Gets or sets the largest number of channels that can be pending during the reliable session. |
Max |
Gets or sets the maximum number of times that a message attempts to be transferred during the reliable session. |
Max |
Gets or sets the largest number of messages that can exist in either the send buffer or the receive buffer. |
Ordered |
Gets or sets a value that indicates whether message delivery must preserve the order in which messages are sent. |
Reliable |
Gets or sets the version of WS-ReliableMessaging specified by the binding element. |
Build |
Returns a factory that creates a channel of a specified type that supports a reliable session. |
Build |
Returns a listener that accepts a channel of a specified type that supports a reliable session. |
Build |
Initializes a channel listener to accept channels of a specified type from the binding context. (Inherited from BindingElement) |
Can |
Returns a value that indicates whether the channel factory can be built for the channel and context provided that can support a reliable session. |
Can |
Returns a value that indicates whether the channel listener can be built for the channel and context provided that can support a reliable session. |
Can |
Returns a value that indicates whether the binding element can build a listener for a specific type of channel. (Inherited from BindingElement) |
Clone() |
Creates a copy of the current reliable session binding element. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets a property of the specified type from its binding context. |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
IPolicy |
Maps 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. |
Termék | Verziók |
---|---|
.NET | 8 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást: