# <netMsmqBinding>

Defines a queued binding suitable for cross-machine communication.

<configuration>
<system.serviceModel>
<bindings>
<netMsmqBinding>

## Syntax

<netMsmqBinding>
<binding closeTimeout="TimeSpan"
durable="Boolean"
exactlyOnce="Boolean"
maxBufferPoolSize="Integer"
maxRetryCycles="Integer"
name="String"
openTimeout="TimeSpan"
poisonMessageHandling="Disabled/EnabledIfSupported"
queueTransferProtocol="Native/Srmp/SrmpSecure"
rejectAfterLastRetry="Boolean"
retryCycleDelay="TimeSpan"
sendTimeout="TimeSpan"
timeToLive="TimeSpan"
useActiveDirectory="Boolean"
useMsmqTracing="Boolean"
useSourceJournal="Boolean">
<security>
<message algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
<transport msmqAuthenticationMode="None/WindowsDomain/Certificate"
msmqEncryptionAlgorithm="RC4Stream/AES"
msmqProtectionLevel="None/Sign/EncryptAndSign"
msmqSecureHashAlgorithm="MD5/SHA1/SHA256/SHA512" />
</security>
maxDepth="Integer"
maxNameTableCharCount="Integer"
maxStringContentLength="Integer" />
</binding>
</netMsmqBinding>


## 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.
customDeadLetterQueue A URI that contains the location of the per-application dead letter queue, where messages that have expired or that have failed transfer or delivery are placed.

The dead letter queue is a queue on the queue manager of the sending application for expired messages that have failed to be delivered.

The URI that is specified by CustomDeadLetterQueue must use the net.msmq scheme.
deadLetterQueue A DeadLetterQueue value specifying which type of dead-letter queue to use, if any.

A dead-letter queue is the place where messages that have failed to be delivered to the application will be transferred.

For messages that require exactlyOnce assurance (that is, the exactlyOnce attribute is set to true), this attribute defaults to the system-wide transactional dead-letter queue in MSMQ.

For messages that require no assurances, this attribute defaults to null.
durable A Boolean value that indicates whether the message is durable or volatile in the queue. A durable message survives a queue manager crash, while a volatile message does not. Volatile messages are useful when applications require lower latency and can tolerate occasional lost messages. If the exactlyOnce attribute is set to true, the messages must be durable. The default is true.
exactlyOnce A Boolean value that indicates whether each message processed by this binding is delivered only once. The sender will then be notified of delivery failures. When durable is false, this attribute is ignored and messages are transferred without delivery assurance. The default is true. For more information, see ExactlyOnce.
maxBufferPoolSize An integer that specifies the maximum buffer pool size for this binding. The default is 8.
maxReceivedMessageSize A positive integer that defines the maximum message size, in bytes, including headers, that is processed by this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536. This bound on message size is intended to limit exposure to Denial of Service (DoS) attacks.
maxRetryCycles An integer that indicates the number of retry cycles used by the poison-message detection feature. A message becomes a poison message when it fails all delivery attempts of all cycles. The default is 3. For more information, see MaxRetryCycles.
name Required attribute. 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.
QueueTransferProtocol A valid QueueTransferProtocol value that specifies the queued communication channel transport that this binding uses. MSMQ does not support Active Directory addressing when using SOAP Reliable Messaging Protocol. Therefore, you should not set this attribute to Srmp or Srmps when the useActiveDirectory attribute is set to true.
receiveErrorHandling A ReceiveErrorHandling value that specifies how poison and nondispatchable messages are handled.
receiveRetryCount An integer that specifies the maximum number of times the queue manager should attempt to send a message before transferring it to the retry queue.
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.
retryCycleDelay A TimeSpan value that specifies the time delay between retry cycles when attempting to deliver a message that could not be delivered immediately. The value defines only the minimum wait time because actual wait time can be longer. The default value is 00:10:00. For more information, see RetryCycleDelay.
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.
timeToLive A TimeSpan value that specifies how long the messages are valid before they are expired and put into the dead-letter queue. The default is 1.00:00:00.

This attribute is set to ensure that time-sensitive messages do not become stale before they are processed by the receiving applications. A message in a queue that is not consumed by the receiving application within the time interval specified is said to be expired. Expired messages are sent to special queue called the dead letter queue. The location of the dead letter queue is set with the DeadLetterQueue attribute or to the appropriate default, based on assurances.
usingActiveDirectory A Boolean value that specifies if queue addresses should be converted using Active Directory.

MSMQ queue addresses can consist of path names or direct format names. With a direct format name, MSMQ resolves the computer name using DNS, NetBIOS or IP. With a path name, MSMQ resolves the computer name using Active Directory.

By default, Windows Communication Foundation (WCF) queued transport converts the URI of a message queue to a direct format name. By setting the UseActiveDirectory property to true, an application can specify that the queued transport should resolve the computer name using Active Directory rather than DNS, NetBIOS, or IP.
useMsmqTracing A Boolean value that specifies whether messages processed by this binding should be traced. The default is false. When tracing is enabled, report messages are created and sent to the report queue each time the message leaves or arrives at a Message Queuing computer.
useSourceJournal A Boolean value that specifies copies of messages processed by this binding should be stored in the source journal. The default is false.

Queued applications that want to keep a record of messages that have left the computer's outgoing queue can copy the messages to a journal queue. Once a message leaves the outgoing queue and an acknowledgment is received that the message was received on the destination computer, a copy of the message is kept in the sending computer's system journal queue.

### 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.
<security> Defines the security settings for the binding. This element is of type NetMsmqSecurityElement.

### Parent Elements

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

## Remarks

The netMsmqBinding binding provides support for queuing by leveraging Microsoft Message Queuing (MSMQ) as a transport and enables support for loosely coupled applications, failure isolation, load leveling and disconnected operations. For a discussion of these features, see Queues in WCF.

## Example

<configuration>
<system.ServiceModel>
<bindings>
<netMsmqBinding>
<binding closeTimeout="00:00:10"
openTimeout="00:00:20"
sendTimeout="00:00:40"
durable="true"
exactlyOnce="true"
maxRetries="11"
maxRetryCycles="12"
poisonMessageHandling="Disabled"
rejectAfterLastRetry="false"
retryCycleDelay="00:05:55"
timeToLive="00:11:11"
sourceJournal="true"
useMsmqTracing="true"
useActiveDirectory="true">
<security>
<message clientCredentialType="Windows" />
</security>
</binding>
</netMsmqBinding>
</bindings>
</system.ServiceModel>
</configuration>