Working with WCF in general is quite nice. No longer are you troubled by the idiosyncrasies of the various communication protocols as they are bundled into the same API. Of course that doesn’t make the different protocols identical and there are still some differences to be handled. One thing is the netMsmqBinding binding and poison messages.
In general it isn’t to hard to handle poison messages. Using Vista you can even reject or move them to a poison queue for later inspection. Not that much luck in Windows XP though. Basically you have two options, either Fault (the default) or Drop the message.
Now dropping the message us not very nice as the information gets lost so faulting and removing and logging the message from a IErrorHandler is a better solution. And in fact an MsmqPoisonMessageException is raised when a poison message is detected. In fact it even contains the MessageLookupId to retrieve the message itself. But how about the queue name? That is missing. And the samples on MSDN show how to do this by adding the queue names twice, once in the WCF configuration and a second time just for the purpose of removing the poison message. Looks like some king of oversight if you ask me. I guess I need to hook into the message pipeline somewhere and watch messages coming in via the queues and record the LookupId and queue used. Only problem is that I haven’t found the point to do so yet Any hints are appreciated!