Search code examples
wcfwcf-binding

Binding for message type in WCF


I have a method in WCF which has a return type of Message as well as the input as message whcih type of binding will be used for this...what will be the service model in my config file


Solution

  • The binding specified for the service (i.e., WsHttpBinding, NetTcpBinding, etc) is applied to the whole service, not just specific parts. Nor can you have a service that has different bindings for different parts.

    I.e., you can't have Service A with a ServiceContract using WsHttpBinding, the DataContract using NetTcpBinding, etc.

    You can have Service A expose different endpoints with different bindings, but the point is the binding applies to a given service as a whole. It's the B part of the ABCs of WCF - Address, Binding and Contract.