WCF,请教一下回调

wpf250 2014-02-07 12:24:31
假设服务端有下面两个接口:

public interface IService //服务协定
{ }
public class MyService:IService //服务实现
{ }
public interface ICallback //回调协定
{ }


客户端:

public class MyCallback:ICallback //实现回调协定
{ }


问题:
我想问下,如果客户端调用服务,那么整个过程到底是怎么样的呢?
客户端首次调用服务的时候,是在服务端执行服务操作的吧,那执行回调是怎么执行的呢?因为回调是在客户端实现的,那是通知客户端执行还是怎么的呢?
...全文
128 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
宝_爸 2014-02-07
  • 打赏
  • 举报
回复
不是所有的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.
小猪八Q 2014-02-07
  • 打赏
  • 举报
回复
http://www.cnblogs.com/wpfworld/category/530339.html http://www.cnblogs.com/wpfworld/p/3409402.html 参考理解下这个吧 服务器端可以拿到客户端的回调实例,通过网络通信,实现服务的回调
  • 打赏
  • 举报
回复
生成本地代理类
jiaoshiyao 2014-02-07
  • 打赏
  • 举报
回复
引用 2 楼 findcaiyzh 的回复:
不是所有的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.
What are you saying?I just say oh my god!This is a maoxian,And i and my little friends all jingdaile!
wpf250 2014-02-07
  • 打赏
  • 举报
回复
回调对象,是哪里创建的呢?是客户端创建之后,通过网络传给服务端的吗?没有看到过客户端游动手动创建回调对象的啊

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧