假设服务端有下面两个接口: public interface IService //服务协定 { } public class MyService:IService //服务实现 { } public interface ICallback //回调协定 { } 客户端: public class MyCallback:ICallback //实现回调协定 { } 问题: 我想问下,如果客户端调用服务,那么整个过程到底是怎么样的呢? 客户端首次调用服务的时候,是在服务端执行服务操作的吧,那执行回
不是所有的binding都支持callback的。
一下来自:
What You Need To Know About One-Way Calls, Callbacks, And Events
http://msdn.microsoft.com/en-us/magazine/cc163537.aspx
The client also has to facilitate hosting the callback object. Not all bindings support callback operations. Because of its connectionless nature, HTTP can't be used for callbacks and therefore you can't use callbacks over BasicHttpBinding or WSHttpBinding. Windows Communication Foundation offers callback support for NetTcpBinding and NetNamedPipeBinding because the underlying transport is bidirectional. To support callbacks over HTTP, Windows Communication Foundation provides WSDualHttpBinding, which actually sets up two HTTP channels: one for the calls from the client to the service and one for the calls from the service to the client.