I am trying to create a WCF service, that has a webHttpBinding endpoint (for Java clients) and a netTcpBinding endpoint (for .NET clients).
With the netTcpBinding endpoint I would like to be able to use callbacks in order to be alerted to events, but when I try to configure this, WCF complains because the service also has the webHttpBinding endpoint, which doesn’t support callbacks.
Is there a way of having the callback utilised by one endpoint but not another?
No, the binding will validate that it can honor the contract; if the contract is a duplex contract (i.e., it specifies a
CallbackContract) but the binding can’t do duplex, then it will throw during validation.What you can do is to have a base contract which is used by the
webHttpBindingendpoint, and another contract (this time a duplex one), derived from the first, which is used by thenetTcpBindingendpoint.The code below shows an example of such contract arrangement.