gpt4 book ai didi

wcf - WCF 回调如何通过 HTTP 工作?

转载 作者:可可西里 更新时间:2023-11-01 15:14:06 25 4
gpt4 key购买 nike

据我了解,在 HTTP 中,客户端连接到服务器并请求数据。服务器无法调用客户端。如果是这种情况,那么 WCF 回调如何工作?

谢谢,

最佳答案

当与 HTTP 传输一起使用时,服务器确实调用客户端。为了使其正常工作,客户端必须位于公共(public)端点上,因此需要适本地配置防火墙和您拥有的东西。

来自 http://msdn.microsoft.com/en-us/magazine/cc163537.aspx :

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.

来自 WSDualHttpBinding 的引用资料 http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspx :

This binding requires that the client has a public URI that provides a callback endpoint for the service. This is provided by the ClientBaseAddress. A dual binding exposes the IP address of the client to the service. The client should use security to ensure that it only connects to services it trusts.

关于wcf - WCF 回调如何通过 HTTP 工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7964758/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com