Project Description
How to create highly available duplex services in WCF ? Use Msmq over duplex without reliable session.
reliable session with MSMQ messaging is a none sense because messaging is for two services which don't run necessarily at the same time, but like MSDN said, "WCF supports reliable sessions between endpoints that are active and alive at the same time". So I will not use this solution.

This project is a sample to use duplex channel with MSMQ without reliable session.
I was helped by this blog which found a solution to use MSMQ over duplex, but with reliable session. His solution required reliable session because it's during the first handshake that the callback address is sent to the service.

To avoid using reliable session I send the callback address in the header of every message sent to the service. (ReplyTo header)
On the client side, I specify an URI to listen with the ListenUriBindingElement, with CompositeDuplexBindingElement, and then the ReplyToBindingElement which takes care of adding headers to outgoing messages.

The server side works the same way, the only difference is that I was forced to create a behavior ReplyToBehavior which takes headers on the incoming message (ReplyTo for example) and set them correctly on the outgoing message (To).
I don't know why I need to explicitly do that on the server side and not on the client side...

With my solution client and server can exchange messages via msmq and use a callback contract in both sides.

I have not coded metadata importer, and binding configuration element, if someone can do that, I'll be grateful, otherwise you'll have to wait. (don't hesitate to tell me what you would like me to do)

Implementation details here :
Happy coding,

Last edited Aug 30, 2009 at 2:28 PM by Slashene, version 5