Endpoint EndPoint
WCF service publishes a series of endpoint information, each endpoint is the entrance to interact with the outside world. All WCF communication happens through these endpoints, each endpoint is composed of the following three parts:
Address
base URL, indicating the path of the WCF service deployment. The client uses the url to connect to the service
http://localhost:8090/MyService/SimpleCalculator.svc
Binding
Binding describes how the client communicates with the server. There are several communication protocols for the server to communicate with the client. You can choose the protocol according to your needs.
Binding has a variety of different characteristics, as follows:
Transport - defines basic protocols, such as HTTP, Named Pipes, TCP and MSMQ, etc.
Encoding(MTOM), MTOM is an interoperable message format that can transmit larger messages (greater than 64K) more efficiently.
Protocol (optional) - Defines the security mechanism, transport mechanism or trusted mechanism used when binding Messages
The following
Binding | Description |
BasicHttpBinding | Basic web service communication, no security mechanisms |
WSHttpBinding | Supports WS-* Web service communication, supports transactions |
WSDualHttpBinding | Web service communication with duplex contracts, support for transactions |
WSFederationHttpBinding | Web service communication supporting federated contracts, supporting transactions |
MsmqIntegrationBinding | Web service communication that communicates directly with MSMQ, supports transactions |
NetMsmqBinding | Web service communication using queues to communicate with WCF applications, supports transactions |
NetNamedPipeBinding | Web service communication that communicates with WCF applications on the same computer, supports duplexing and supports transactions |
NetPeerTcpBinding | Web service communication using P2P for communication between different computers, supporting duplex |
NetTcpBinding | Web service communication to communicate between different computers, supporting duplex and transactions |
The contract
specifies a series of operations provided by the endpoint that communicates with the outside world. Usually the contract document will mention the interface, so that the client can understand the operation provided by the contract through this interface, and each operation is a simple exchange Modes Unidirectional, Duplex, Request/Response
The following
Example:
Write in web.
<system.serviceModel> <services> <service name="MathService" behaviorConfiguration="MathServiceBehavior"> <endpoint address="http://localhost:8090/MyService/MathService.svc" contract="IMathService" binding="wsHttpBinding"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MathServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>