Επεξεργασία

Κοινή χρήση μέσω


<udpBinding>

A configuration element used to configure the UdpBinding binding.

<configuration>
  <system.serviceModel>
    <bindings>
      <udpBinding>

Syntax

<udpBinding>
  <binding closeTimeout="TimeSpan"
           duplicateMessageHistoryLength="Integer"
           maxBufferPoolSize="Integer"
           maxBufferSize="Integer"
           maxPendingMessagesTotalSize="Integer"
           maxReceivedMessageSize="Integer"
           maxRetransmitCount="Integer"
           multicastInterfaceId="Integer"
           name="String"
           openTimeout="TimeSpan"
           receiveTimeout="TimeSpan"
           sendTimeout="TimeSpan"
           textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding"
           timeToLive="TimeSpan">
    <readerQuotas maxArrayLength="Integer"
                  maxBytesPerRead="Integer"
                  maxDepth="Integer"
                  maxNameTableCharCount="Integer"
                  maxStringContentLength="Integer" />
  </binding>
</udpBinding>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
closeTimeout A TimeSpan value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.
duplicateMessageHistoryLength An integer value that specifies the duplicate message history length.
maxBufferPoolSize An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.
maxBufferSize An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.
maxPendingMessagesTotalSize An integer value that specifies the maximum number of messages that are received but not yet removed from the input queue for an individual channel instance.
maxReceivedMessageSize A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.
maxRetransmitCount An integer value that specifies the maximum number of retransmit messages.
multicastInterfaceId An integer value that specifies the multicast interface ID.
name A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.
openTimeout A TimeSpan value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.
receiveTimeout A TimeSpan value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to Zero. The default is 00:10:00.
sendTimeout A TimeSpan value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.
textEncoding Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type Encoding.
timeToLive A timespan value that specifies the time to live for the binding.

Child Elements

Element Description
<readerQuotas> Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type XmlDictionaryReaderQuotasElement.

Parent Elements

Element Description
<bindings> This element holds a collection of standard and custom bindings.

Remarks

The UdpBinding allows WCF services to communicate over the UDP transport. It allows for "fire and forget" message exchanges where a client sends a message to a service and expects no response back.

Example

The following example shows how to configure the UdpBinding using the <udpBinding> element.

<udpBinding>
  <binding  closeTimeout="00:10:00"
            duplicateMessageHistoryLength="100"
            maxBufferPoolSize="100"
            maxPendingMessagesTotalSize="100000"
            maxReceivedMessageSize="65536"
            maxRetransmitCount="10"
            multicastInterfaceId="00000"
            name="myUdpBinding"
            openTimeout="00:10:00"
            receiveTimeout="00:10:00"
            sendTimeout="00:10:00"
            textEncoding="utf-8"
            timeToLive="00:10:00">
    <readerQuotas />
  </binding>
</udpBinding>

See also