Don
Don

Reputation: 31

Why can't my netmsmqbinding can't do twoway binding?

I'm using WCF and netmsmqbinding and I am getting the following error message:

Contract requires TwoWay (either request-reply or duplex), but Binding 'NetMsmqBinding' doesn't support it or isn't configured properly to support it. Why?

My environment is window 2003 server. The wcf servcie is hosting as a window service. Thank you in advance for your help.

Upvotes: 3

Views: 5281

Answers (2)

Johann Blais
Johann Blais

Reputation: 9469

You can only use OneWay operations with a NetMsmqBinding. You need to set the IsOneWay property of the OperationContract attribute to true.

Explanation here:

All service operations must be one-way because the default queued binding in WCF does not support duplex communication using queues. A two-way communication sample (Two-Way Communication) illustrates how to use two one-way contracts to implement duplex communication using queues.

Upvotes: 0

Patrick Desjardins
Patrick Desjardins

Reputation: 140753

Caveats about queued binding in WCF include that all service operations must be one-way because the default queued binding in WCF does not support duplex communication using queues.

To do not have this error you will need to change the OperationContract attribute. Example below:

[OperationContract(IsOneWay = true)]
void YourMethod(YourClass objectHere)

If you need to have two way operation you will need to use a different binding.

Upvotes: 4

Related Questions