An enumeration that specifies handling for a poison message.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
|This option drops the poison message. The message never gets delivered to the application. If the message's TTL had already expired at this point, then the message may appear in the sender's Dead Letter Queue. If not, the message does not appear anywhere. This option indicates that the user does not really care if the message is lost.|
Applicable platforms: , , and .
|This option sends a fault to the listener that caused the ServiceHost to fault. The message must be removed from the application queue by some external mechanism before the application can continue to process messages from the queue. |
Applicable platforms: Windows XP, Windows Server 2003, and Windows Vista.
|This moves the poison message to a Poison Message Queue for later processing by a poison message handling application. |
Applicable platforms: only.
|This instructs MSMQ to send a negative acknowledgement back to the sending queue manager that the message cannot be received by the application. The message is placed in the sending queue manager's Dead Letter Queue. |
Applicable platforms: only.
A poison message is a message that fails repeated attempts to deliver to the application. This is applicable only when using a Message Queuing (MSMQ)-based binding. The default value is Fault, which faults the listener and therefore the ServiceHost. In the case where the service was to fault because of a poison message, a MsmqPoisonMessageException is thrown. The exception contains the LookupId of the MSMQ message that can be used to move the message out of the way using System.Messaging API. Certain values of the enumeration such as Reject and Move are only available on . You control poison message handling by setting the ReceiveErrorHandling property to one of the values of this enumeration.
The following configuration code illustrates how to set this property in the service configuration file:
<configuration> <appSettings> <!-- use appSetting to configure MSMQ queue name --> <add key="queueName" value=".\private$\ServiceModelSamplesPoison" /> <add key="baseAddress" value="http://localhost:8000/orderProcessor/poisonSample"/> </appSettings> <system.serviceModel> <services> <service name="Microsoft.ServiceModel.Samples.OrderProcessorService"> <!-- Define NetMsmqEndpoint --> <endpoint address="net.msmq://localhost/private/ServiceModelSamplesPoison" binding="netMsmqBinding" bindingConfiguration="PoisonBinding" contract="Microsoft.ServiceModel.Samples.IOrderProcessor" /> </service> </services> <bindings> <netMsmqBinding> <binding name="PoisonBinding" receiveRetryCount="0" maxRetryCycles="1" retryCycleDelay="00:00:05" receiveErrorHandling="Fault" /> </netMsmqBinding> </bindings> </system.serviceModel> </configuration>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.