什么是“端点”? 在WCF?
我的印象是,端点在配置文件中定义为可能的客户端列表,但这没有意义(从某种意义上说,我假设它说哪些计算机可以连接到服务)现在我收集到它更多定义,有人可以解释一下终点对我来说是什么吗? 我理解定义合约接口然后实现合约的概念,但我在其中迷失了方向,并真正拥有了一些可用的东西。
在这种情况下,地址是什么? 主机地址?
绑定使用的通信方法/协议是否正确?
合同本质上是“共享的对象”(是的,我知道这在技术上是不正确的,但请在这里与我合作)
I was under the impression that an endpoint was defined in a config file as the list of possible clients but that makes no sense (in the sense that I assumed it said what computers could connet to the service) now I'm gathering that it's more of a definition, so would someone please explain what an end point is to me? I understand the concept of definining the contract interface and then implementing the contract but I get lost somewhere between there and actually having something useable.
What is an address in this context? the host address?
A binding is the communications method/protocol to use correct?
the contract is the "object being shared" essentially (yes i know that's so technically incorrect but work with me here)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
端点是服务公开的内容,用 WCF 术语来说,由三部分组成:
地址是可以访问端点的 URL。
绑定规定了所应用的转换以及发送到地址上的合约实现的消息的形状(在某种程度上)。
合同规定了在该地址上公开哪些操作。 正如它所说的那样,它是一个合同,表明哪些调用是允许的。
大多数时候,人们会记得它为 AB C。
需要注意的事项:
绑定通常是通道与所应用行为的组合; 通道是通道堆栈上的元素,它们在到达服务实现之前修改消息并执行操作。
虽然通常由 .NET 中的接口表示,但并不要求以这种方式表示合约。 一些设计优先的倡导者将首先定义将要发送的请求和响应消息的架构,这就是 WCF 将 .NET Contract 接口转换成的架构。
An endpoint is what a service exposes, and in WCF terms, is made up of three things:
Address is the URL by which the endpoint can be reached.
Binding dictates transformations that are applied as well as the shape (to some degree) of the messages sent to the implementation of the Contract at the Address.
Contract dictates what operations are being exposed at the address. It's exactly what it says it is, it's a contract to indicate what calls are permissible.
Most of the time, people remember it as A B C.
Some things to note:
The binding is typically going to be a combination of channels with behaviors applied; channels being elements on the channel stack which modify the message and perform actions before they get to the service implementation.
While commonly represented by an interface in .NET, it is not a requirement that a Contract be represented in this manner. Some design-first advocates will define the schemas to the messages that are going to be sent for the request and the response first, which is what WCF transforms the .NET Contract interface into.
我将在这里引用 Juval Lowy 的WCF 服务编程:
I'm going to cite Juval Lowy's Programming WCF Services here:
WCF 中的端点
WCF 服务是一个公开端点集合的程序。 每个端点都是与世界通信的门户。
终点由三个部分组成。
1) 地址:
定义服务所在位置
ex - http://www.test.com:8001/MyService
2) 绑定:
指定客户端如何与端点通信的绑定。
ex - BasicHttpBinding、WSHttpBinding、WSDualHttpBinding 等
3) 合同:
标识可用操作的合同
端点将在创建的服务的 web.config 文件中提及。
Endpoints in WCF
WCF Service is a program that exposes a collection of Endpoints. Each Endpoint is a portal for communicating with the world.
End point consists of three components.
1) Address :
Defines where a service is located
ex - http://www.test.com:8001/MyService
2) Bindings :
A binding that specifies how a client can communicate with the endpoint.
ex - BasicHttpBinding,WSHttpBinding,WSDualHttpBinding etc
3) Contracts :
A contract that identifies the operations available
Endpoints will be mentioned in the web.config file on the created service.
服务端点有一个地址、一个绑定和一个合约。
端点地址是端点所在的网络地址。 EndpointAddress 类表示 WCF 端点地址。
端点的绑定指定端点如何与世界通信,包括传输协议(例如,TCP、HTTP)、编码(例如,文本、二进制)和安全要求(例如,SSL、SOAP 消息安全)等。 Binding 类代表 WCF 绑定。
端点的契约指定端点通信的内容,本质上是在具有基本消息交换模式(MEP)(例如单向、双工和请求/答复)的操作中组织的消息集合。 ContractDescription 类代表 WCF 合同。
A Service Endpoint has an Address, a Binding, and a Contract.
The Endpoint's Address is a network address where the Endpoint resides. The EndpointAddress class represents a WCF Endpoint Address.
The Endpoint's Binding specifies how the Endpoint communicates with the world including things like transport protocol (e.g., TCP, HTTP), encoding (e.g., text, binary), and security requirements (e.g., SSL, SOAP message security). The Binding class represents a WCF Binding.
The Endpoint's Contract specifies what the Endpoint communicates and is essentially a collection of messages organized in operations that have basic Message Exchange Patterns (MEPs) such as one-way, duplex, and request/reply. The ContractDescription class represents a WCF Contract.
请参阅此处:
服务端点指定用于通信的地址、绑定和契约。
See here:
A service endpoint specifies an address, a binding, and a contract to use for communication.
服务端点有一个地址、一个绑定和一个合约。 端点地址是端点所在的网络地址。 EndpointAddress 类表示 WCF 端点地址。 端点的绑定指定端点如何与世界通信,包括传输协议(例如,TCP、HTTP)、编码(例如,文本、二进制)和安全要求(例如,SSL、SOAP 消息安全)等。 Binding 类代表 WCF 绑定。 端点的契约指定端点通信的内容,本质上是在具有基本消息交换模式(MEP)(例如单向、双工和请求/答复)的操作中组织的消息集合。 ContractDescription 类代表 WCF 合同。
A Service Endpoint has an Address, a Binding, and a Contract. The Endpoint's Address is a network address where the Endpoint resides. The EndpointAddress class represents a WCF Endpoint Address. The Endpoint's Binding specifies how the Endpoint communicates with the world including things like transport protocol (e.g., TCP, HTTP), encoding (e.g., text, binary), and security requirements (e.g., SSL, SOAP message security). The Binding class represents a WCF Binding. The Endpoint's Contract specifies what the Endpoint communicates and is essentially a collection of messages organized in operations that have basic Message Exchange Patterns (MEPs) such as one-way, duplex, and request/reply. The ContractDescription class represents a WCF Contract.
Web 服务端点可以隐藏其中的部分或全部。 并且根据Request可以内部决定Request的处理。
SRJTester 工具(可在 Github 上找到)非常适合在发出服务请求时指定端点、操作、协议等。
A web service endpoint can hide some or all of these. And based on request can decide internally the processing of Request.
SRJTester tool (available on Github) is nice to specify Endpoint, Actions, protocols etc. while making a service request.
Endpoint 用于配置客户端应用程序和 WCF 服务之间的通信通道
Endpoint 示例
Endpoint is used to configure the communication channel between the client application and the WCF service
End point sample