Nicolas Dorier
Nicolas Dorier

Reputation: 7465

Why WCF doesn't automatically affect the To header on outgoing message with the ReplyTo of the incoming message?

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.

Upvotes: 0

Views: 1178

Answers (2)

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65361

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

Upvotes: 0

marc_s
marc_s

Reputation: 754240

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

Upvotes: 0

Related Questions