Message.UseDeadLetterQueue 属性


获取或设置一个值,该值指示是否将未能传递的消息的副本发送到死信队列。Gets or sets a value that indicates whether a copy of the message that could not be delivered should be sent to a dead-letter queue.

 property bool UseDeadLetterQueue { bool get(); void set(bool value); };
public bool UseDeadLetterQueue { get; set; }
member this.UseDeadLetterQueue : bool with get, set
Public Property UseDeadLetterQueue As Boolean


如果消息传递失败应导致向死信队列发送消息的副本,则为 true,否则为 falsetrue if message-delivery failure should result in a copy of the message being sent to a dead-letter queue; otherwise, false. 默认值为 falseThe default is false.



消息队列经过筛选后忽略了 UseDeadLetterQueue 属性。The message queue is filtered to ignore the UseDeadLetterQueue property.


下面的代码示例获取并设置消息的UseDeadLetterQueue属性的值。The following code example gets and sets the value of a message's UseDeadLetterQueue property.


UseJournalQueueUseDeadLetterQueue属性指定消息队列跟踪消息的方式。The UseJournalQueue and UseDeadLetterQueue properties specify how Message Queuing tracks a message. 如果UseDeadLetterQueuetrue, 则传递失败 (对于非事务性消息) 将导致消息发送到无法传递消息的计算机上的非事务性死信队列。If UseDeadLetterQueue is true, delivery failure (of a non-transactional message), causes the message to be sent to the non-transactional dead-letter queue on the computer that could not deliver the message. 例如, 消息计时器过期可能会导致传递失败。Delivery failure could be caused by a message timer expiring, for example.

如果事务消息传递失败, 则消息队列会在所有负面和有疑问的情况下将消息发送到源计算机上的事务性死信队列。In the case of delivery failure for a transactional message, Message Queuing sends the message to the transactional dead-letter queue on the source machine in all negative and in-doubt cases.

将消息存储在死信队列中时, 应定期清除队列, 以删除不再需要的消息。When you store messages in a dead-letter queue, you should clear the queue periodically to remove messages that are no longer needed. 死信队列中存储的消息会根据队列所在计算机的大小配额计数。Messages stored in dead-letter queues count against the size quota for the computer where the queue resides. 计算机配额由管理员设置, 是指为在整个计算机上存储消息而不只是在单个队列中分配的大小。The computer quota is set by the administrator and refers to the size allocated for storing messages on the whole computer, not just in a single queue.

不创建日志或死信队列。You do not create a journal or dead-letter queue. 这两个都是消息队列生成的系统队列。These are both system queues that Message Queuing generates.