tags:

views:

193

answers:

3

I want to log the Poison message that my wcf service is dropping using MSMQ 3.0 and windows 2003

A: 

You could probably add a service like the following that reads messages from your poison queue and logs them.

<service name="YourPosionMessageHandler"
   <endpoint
address="net.msq://locahost/private/YourServiceQueue;poison"
binding="netMsmqBinding"
    />
</service>
aogan
This only works with MSMQ 4.0. MSMQ 3.0 doesn't support poison queues.
Keith Elder
+1  A: 

You can implement a custom IErrorHandler and associate it with your service using a custom behavior. In your implementation, check if the exception raised is of type MsmqPoisonMessageException, and if so, go out and grab the message from the queue using System.Messaging,MessageQueue and log it.

There's a sample that shows how most of this stuff is done: it moves the message to another queue, but should be trivial to modify it so that it just logs the message somewhere instead.

tomasr
A: 

There is a perfect example for this on MSDN. http://msdn.microsoft.com/en-us/library/ms751472.aspx

Olivier