Service Endpoints

本文详细阐述了应用如何通过提供服务端点使客户端能够发送请求。解释了服务地址、支持的绑定及服务合同的概念,并深入探讨了这些要素对于确保通信质量和数据交换格式的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A host application makes a service available to client applications by providing one or more endpoints to which clients can send requests. An endpoint contains three pieces of information:

1. The address of the service. The form of a service address depends on several factors,including the transport protocol being used. Different transport mechanisms use different address spaces.

2. The binding supported by the service. The binding for a service describes how a client can connect to the service and the format of the data expected by the service.A binding can include the following information:

  • The transport protocol.This must conform to the requirements of the service address.
  • The encoding format of messages.In many cases, request and response messages will be transmitted in XML format, encoded as ordinary text. However, in some cases you might need to transmit data using a binary encoding, especially if you are transmitting images or handling streams.
  • The security requirements of the service. You can implement security at the transport level and at the message level, although different transport protocols have their own limitations and requirements.
  • The transactional requirements of the service.A service typically provides access to one or more resources. Client applications update these resources by sending requests to the service. If a client makes multiple requests of a service that result in multiple updates, it can be important to ensure that all of these updates are made permanent.
  • The reliability of communications with the service.Clients usually connect to services across a network. Networks are notoriously unreliable and can fail at any time. If a client application is performing a conversation (an ordered exchange of several messages) with a service, information about the reliability of the service is important.

3.The contract implemented by the service.A WCF service contract is an interface stored in a .NET Framework assembly and annotated with the ServiceContract attribute. The service contract describes the operations implemented by the service by tagging them with the OperationContract attribute. Any data passed to and from operations must be serializable. A service can define data contracts that describe the structure of complex data and how that data should be serialized. The service can publish the description of its service contract, which a client application can use to ascertain the operations that the service implements and to send messages that are correctly formatted.

转载于:https://www.cnblogs.com/fast-michael/archive/2011/12/16/2290495.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值