如何使用 WCF 设置仅用于服务器回调的连接和仅用于客户端调用的连接?
我想我没有说清楚。我的意思是如何使用 WCF 在与“客户端到服务器”连接不同的连接中设置回调(“服务器到客户端”)?
我总是看到仅使用一个 DuplexChannelFactory 的回调示例。这意味着仅使用一个 TCP 连接来进行客户端到服务器的调用并接收服务器到客户端的回调。
在我读完这个主题后,我想到了这个问题: 寻求 WCF 双工“TwoWay”订阅+回调示例
我是最佳答案,Ian林格罗斯说道:
我发现一些有助于避免死锁的规则。 (看看我的 WCF 问题就知道我的痛苦了!)
当来自同一客户端的调用正在进行时,服务器绝不能在同一连接上调用客户端。
和/或
在处理回调时,客户端绝不能在用于“回调”的同一连接上回调服务器。
我想知道如何使用 WCF 来实现它。
I don't think I was clear. What I meant was How to set a callback("server to client") in a different connection from a "client to server" connection using WCF ?
I always saw callbacks examples using just one DuplexChannelFactory. This implies using only one TCP connection to make client to server calls and receive server to client callbacks.
This question came to me after I read this this topic:
Seeking WCF Duplex "TwoWay" Subscribe+Callback Example
I the top answer, Ian Ringrose said:
Some rules I found to help avoid deadlocks. (Look at my WCF questions to see the pain I had!)
The sever must never call out to a client on the same connection as a call from the same client is in process on.
And/or
The client must never call back to the server on the same connection as is used for the “callbacks” while processing a call-back.
And I was wondering how to implement it using WCF.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Double-Simplex WCF 的稳健的应用程序间通信上的此 CodeProject 准确回答了您的问题:
它的解决方式满足您从 Ian Ringrose 答案中提取的要求。
This CodeProject on Robust Interapplication Communications using Double-Simplex WCF answers exactly your question:
The way it is solved meets the requirements you have extracted from the Ian Ringrose answer.