views:

302

answers:

2

I have a service which send a message with the ReplyTo header set to a return address. I thought that :

OperationContext.Current.GetCallbackChannel<IHelloCallback>().RespondHello("tomi");

will automatically invoke my client, but I receive this exception :

For sending a message on server side composite duplex channels, the message must have either the 'Via' property or the 'To' header set.

Am I doing something wrong or WCF is a little bit lazy ?

Currently, I use a behavior with a message inspector to make these headers match, but it seems a little hacky...

ps : I'm using MSMQ

Update

I've created two binding elements to make msmq over duplex work it's available on codeplex You can see the whole example, but like I said, because of this error I use a behavior with a message inspector to set the To header of outgoing message to the ReplyTo of the incoming message. What is strange is that my client, doesn't need this behavior and he is able tu callback my service too.

A: 

This error can occur if you do not have reliable session turned on.

EDIT:

Here is a link to someone who seems to have managed to use MSMQ transport as a duplex transport:

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2006/10/26/8937.aspx

Hope it helps

Shiraz Bhaiji
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 http://msdn.microsoft.com/en-us/library/ms733136.aspx, "WCF supports reliable sessions between endpoints that are active and alive at the same time". So I will not use this solution.
Nicolas Dorier
YOu didn't mention MSMQ in your question........
marc_s
oups you're right sorry ;)
Nicolas Dorier
A: 

Did you create your own custom binding for MSMQ to include duplex communication? wsDualHttpBinding is the only WCF "out-of-the-box" binding to support duplex communication and thus the CallbackContract mechanism.

If you did - can you please post the binding configuration?

Marc

marc_s
Yes I've created two binding elements to make msmq over duplex work here : duplexmsmq.codeplex.com You can see the whole example, but like I said, because of this error currently, I use a behavior with a message inspector to set the To header of outgoing message to the ReplyTo of the incoming message. What is strange is that my client, doesn't need this behavior and he is able tu callback my service too.
Nicolas Dorier