Search code examples
silverlightwcfbindingpollingduplexhttpbinding

WCF Service using PollingDuplex but also having a standard method with no callbacks


I'm not sure if I'm on the right lines but this is what I'm trying to do, I have a Silverlight application and a WCF service, the Silverlight app "subscribes" to the WCF service using PollingDuplex and the service can send data to any connected clients which works.

The service is marked with [ServiceContract(CallbackContract = typeof(IServiceCallback))] and it is single instanced

The problem is there is another service which should be able to call a standard method on this service to pass it data that will get distributed to the connected Silverlight clients, but because of the above settings it requires it to use callbacks (I can't change the other service).

Is there a way to have both types of operations, callback and standard in the same service if that makes sense?

Thanks for your time


Solution

  • Yes. It is possible. I guess CallbackContract parameter will not stop you from using your service as a regular request/response service (though I have not tried it).

    But for the same contract, you may have to define two end points with different bindings, one with PollingDuplexHttpBinding and another one with basicHttpBinding (with silverlight this is the only other option).

    You have to make sure that you are calling the right operation from the clients using duplex and basic http bindings.