PollingDuplexHttpBinding Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents a binding that a Silverlight 5 client can use to configure endpoints that can communicate with Windows Communication Foundation (WCF) services that are similarly configured for duplex communication with a polling client.
Inheritance Hierarchy
System.Object
System.ServiceModel.Channels.Binding
System.ServiceModel.PollingDuplexHttpBinding
Namespace: System.ServiceModel
Assembly: System.ServiceModel.PollingDuplex (in System.ServiceModel.PollingDuplex.dll)
Syntax
'Declaration
Public Class PollingDuplexHttpBinding _
Inherits Binding
public class PollingDuplexHttpBinding : Binding
The PollingDuplexHttpBinding type exposes the following members.
Constructors
Name | Description | |
---|---|---|
PollingDuplexHttpBinding() | Initializes a new instance of the PollingDuplexHttpBinding class. | |
PollingDuplexHttpBinding(PollingDuplexHttpSecurityMode) | Initializes a new instance of the PollingDuplexHttpBinding class with a specified type of security used by the binding. | |
PollingDuplexHttpBinding(PollingDuplexMode) | Initializes a new instance of the PollingDuplexHttpBinding class with a specified mode of behavior on the server in response to client polling. | |
PollingDuplexHttpBinding(PollingDuplexHttpSecurityMode, PollingDuplexMode) | Initializes a new instance of the PollingDuplexHttpBinding class with a specified type of security and a specified mode of behavior on the server in the way it responses to client polling. |
Top
Properties
Name | Description | |
---|---|---|
CloseTimeout | Gets or sets the interval of time provided for a connection to close before the transport raises an exception. (Inherited from Binding.) | |
DuplexMode | Gets or sets a value that specifies how the server behaves in response to client polling when the communication is configured for duplex polling. | |
EnvelopeVersion | Gets the version of SOAP that is used for messages that are processed by this binding. | |
InactivityTimeout | Gets or sets the maximum interval of time that can pass without activity on a channel before the client or server channel enters a faulted state. The default value is 10 minutes. | |
MaxBufferSize | Gets or sets the maximum size for a buffer that receives messages from the channel. | |
MaxReceivedMessageSize | Gets or sets the maximum size for a message that can be received on a channel configured with this binding. | |
MessageVersion | Gets the message version used by clients and services configured with the binding. (Inherited from Binding.) | |
Name | Gets or sets the name of the binding. (Inherited from Binding.) | |
Namespace | Gets or sets the XML namespace of the binding. (Inherited from Binding.) | |
OpenTimeout | Gets or sets the interval of time provided for a connection to open before the transport raises an exception. (Inherited from Binding.) | |
ReceiveTimeout | Gets or sets the interval of time that a connection can remain inactive, during which no application messages are received, before it is dropped. (Inherited from Binding.) | |
Scheme | Gets the URI transport scheme for the channels and listeners that are configured with this binding. (Overrides Binding.Scheme.) | |
Security | Gets the type of security used with this binding. | |
SendTimeout | Gets or sets the interval of time provided for a write operation to complete before the transport raises an exception. (Inherited from Binding.) | |
TextEncoding | Gets or sets the character encoding that is used for the message text. | |
UseTextEncoding | Gets or sets a value that indicates whether text or binary encoding is used for the message. |
Top
Methods
Name | Description | |
---|---|---|
BuildChannelFactory<TChannel>(BindingParameterCollection) | Builds the channel factory stack on the client that creates a specified type of channel and that satisfies the features specified by a collection of binding parameters. (Inherited from Binding.) | |
BuildChannelFactory<TChannel>(array<Object[]) | Builds the channel factory stack on the client that creates a specified type of channel and that satisfies the features specified by an object array. (Inherited from Binding.) | |
CanBuildChannelFactory<TChannel>(BindingParameterCollection) | Returns a value that indicates whether the current binding can build a channel factory stack on the client that satisfies the collection of binding parameters specified. (Inherited from Binding.) | |
CanBuildChannelFactory<TChannel>(array<Object[]) | Returns a value that indicates whether the current binding can build a channel factory stack on the client that satisfies the requirements specified by an object array. (Inherited from Binding.) | |
CreateBindingElements | Returns an ordered collection of binding elements contained in the current binding. (Overrides Binding.CreateBindingElements().) | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetProperty<T> | Returns a typed object requested, if present, from the appropriate layer in the binding stack. (Inherited from Binding.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
Security is turned off by default, but can be added by setting the PollingDuplexHttpSecurityMode to a value other than None in the PollingDuplexHttpBinding(PollingDuplexHttpSecurityMode) constructor.
The binding is configured to use a binary message encoding and UTF-8 character encoding by default.
There are two time-outs on the PollingDuplexBindingElement used by this binding that are set to default values. ClientPollTimeout specifies the interval of time that a polling request has to complete before timing out; the default value is 5 minutes. The InactivityTimeout specifies the maximum interval of time that can pass without activity on a channel before it enters a faulted state; the default value is 10 minutes. The InactivityTimeout() property can be used to change the default value directly on the binding. But value of thePollTimeout() can be changed on the PollingDuplexBindingElement only when constructing a stack of binding elements for a CustomBinding.
Examples
'Constructors set with different security modes
Dim defaultNoSecurityPDBinding As New PollingDuplexHttpBinding()
Dim transportSecurityPDBinding As New PollingDuplexHttpBinding(BasicHttpSecurityMode.Transport)
Dim transportOnlySecurityPDBinding As New PollingDuplexHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)
'Output txtSecurityMode for binding with transport security: Transport
Dim txtSecurityMode As String = transportSecurityPDBinding.Security.Mode.ToString()
'Inactivity timeout
Dim binding As New PollingDuplexHttpBinding()
'Get default inactivity timeout
Dim defaultInactivityTimeOut As TimeSpan = binding.InactivityTimeout
'Returns default timeout in minutes: 10
Dim txtDefaultInactivityTimeOut As String = defaultInactivityTimeOut.Minutes.ToString()
'Set new inactivity timeout
Dim newInactivityTimeOut As New TimeSpan(0, 5, 0)
binding.InactivityTimeout = newInactivityTimeOut
'Returns new timeout in minutes: 5
Dim txtNewInactivityTimeOut As String = binding.InactivityTimeout.Minutes.ToString()
Dim pollingDuplexBinding As New PollingDuplexHttpBinding()
Dim bindingEC As BindingElementCollection = pollingDuplexBinding.CreateBindingElements()
'Check on binding elements contained in the collection
Dim boolHTBE As Boolean = bindingEC.Contains(GetType(HttpTransportBindingElement))
'Returns true
Dim txtboolHTBE As String = boolHTBE.ToString()
Dim boolHSTBE As Boolean = bindingEC.Contains(GetType(HttpsTransportBindingElement))
'Returns false
Dim txtboolHSTBE As String = boolHSTBE.ToString()
//Constructors set with different security modes
PollingDuplexHttpBinding defaultNoSecurityPDBinding = new PollingDuplexHttpBinding();
PollingDuplexHttpBinding transportSecurityPDBinding = new PollingDuplexHttpBinding(BasicHttpSecurityMode.Transport);
PollingDuplexHttpBinding transportOnlySecurityPDBinding = new PollingDuplexHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
//Output txtSecurityMode for binding with transport security: Transport
string txtSecurityMode = transportSecurityPDBinding.Security.Mode.ToString();
//Inactivity timeout
PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding();
//Get default inactivity timeout
TimeSpan defaultInactivityTimeOut = binding.InactivityTimeout;
//Returns default timeout in minutes: 10
string txtDefaultInactivityTimeOut = defaultInactivityTimeOut.Minutes.ToString();
//Set new inactivity timeout
TimeSpan newInactivityTimeOut = new TimeSpan(0, 5, 0);
binding.InactivityTimeout = newInactivityTimeOut;
//Returns new timeout in minutes: 5
string txtNewInactivityTimeOut = binding.InactivityTimeout.Minutes.ToString();
PollingDuplexHttpBinding pollingDuplexBinding = new PollingDuplexHttpBinding();
BindingElementCollection bindingEC = pollingDuplexBinding.CreateBindingElements();
//Check on binding elements contained in the collection
bool boolHTBE = bindingEC.Contains(typeof(HttpTransportBindingElement));
//Returns true
string txtboolHTBE = boolHTBE.ToString();
bool boolHSTBE = bindingEC.Contains(typeof(HttpsTransportBindingElement));
//Returns false
string txtboolHSTBE = boolHSTBE.ToString();
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.