wcf 为什么客户端需要与服务相同的端点?

发布于 2025-01-06 17:31:31 字数 65 浏览 2 评论 0原文

为什么客户端需要与服务相同的端点? 客户端是否会查找其端点中的地址,并且服务将使用其放入其端点中的地址进行侦听???

why does a client need the same endpoint as the service?
Is it that the client looks to the address which is in its endpoint, and the service will listen with the address that it has put in his endpoint???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月流歌 2025-01-13 17:31:31

简单的答案是,服务和客户端必须就通信机制达成一致 - 这就是端点的用途。

  • 他们必须就地址达成一致 - 服务将在那里侦听请求,客户端将在那里发送其请求。
  • 他们必须就绑定达成一致 - 这是通信的“方式” - 将使用什么传输协议、消息在网络上的样子以及安全性等内容如何配置
  • 他们必须就合同达成一致,因为这是一个定义可用的功能以及预期和可能返回的数据

换句话说,他们必须就端点定义达成一致。

但是,事情比实际情况要复杂一些,

  • 地址实际上是“逻辑地址”,即服务侦听的物理地址on 由 listenUri 定义,其中客户端可以通过定义 clientVia 端点行为来发送消息,
  • 绑定必须兼容,客户端可以在其绑定中发送附加数据,这些数据不是用于服务,而是用于某些路由中介
  • 契约必须兼容,因为 WCF 序列化引擎必须能够根据其契约定义呈现或反序列化消息的结构

The simple answer is that the service and client must agree on the mechanics of communication - that's what the endpoint is for

  • They must agree on the address - the service will listen for requests there and the client will send its requests there.
  • They must agree on the binding - this is the "how" of the communication - what transport protocol will be used, what will messages look like on the wire and how are things like security configured
  • They must agree on the contract as this is a definition of what functionality is available and what data is expected and potentially returned

In other words they must agree on the endpoint definition

However, things are a little more complex than that in reality

  • the address is really a "logical address" the physical address the service listens on is defined by the listenUri which the client can send messages to by defining a clientVia endpoint behavior
  • the binding must be compatible, the client can send additional data in its binding which isn't intended for the service but rather, say, some routing intermediary
  • the contracts must be compatible in that the WCF serialization engine must be able to render or deserialise the structure of the message based on its contract definition
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文