All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service.
Each endpoint consists of four properties:
Each endpoint consists of four properties:
-
An Address that indicates where the endpoint can be found.
-
A Binding that specifies how a client can communicate with the endpoint.
-
A Contract that identifies the operations available.
- A set of behaviors that specify local implementation details of the endpoint.
![]() |
End Point |
Address
Basically URL, specifies where this WCF service is hosted .Client will use this url to connect to the service. e.g
http://localhost:8090/MyService/SimpleCalculator.svc
http://localhost:8090/MyService/SimpleCalculator.svc
Binding
Binding will describes how client will communicate with service.
There are different protocols available for the WCF to communicate to
the Client. You can mention the protocol type based on your
requirements.
A binding has several characteristics, including the following:
A binding has several characteristics, including the following:
- Transport -Defines the base protocol to be used like HTTP, Named Pipes, TCP, and MSMQ are some type of protocols.
- Encoding (Optional) - Three types of encoding are available-Text, Binary, or Message Transmission Optimization Mechanism (MTOM). MTOM is an interoperable message format that allows the effective transmission of attachments or large messages (greater than 64K).
- Protocol(Optional) - Defines information to be used in the binding such as Security, transaction or reliable messaging capability
Binding | Description |
---|---|
BasicHttpBinding | Basic Web service communication. No security by default |
WSHttpBinding | Web services with WS-* support. Supports transactions |
WSDualHttpBinding | Web services with duplex contract and transaction support |
WSFederationHttpBinding | Web services with federated security. Supports transactions |
MsmqIntegrationBinding | Communication directly with MSMQ applications. Supports transactions |
NetMsmqBinding | Communication between WCF applications by using queuing. Supports transactions |
NetNamedPipeBinding | Communication between WCF applications on same computer. Supports duplex contracts and transactions |
NetPeerTcpBinding | Communication between computers across peer-to-peer services. Supports duplex contracts |
NetTcpBinding | Communication between WCF applications across computers. Supports duplex contracts and transactions |
Contract
Collection of operation that specifies what the endpoint will
communicate with outside world. Usually name of the Interface will be
mentioned in the Contract, so the client application will be aware of
the operations which are exposed to the client. Each operation is a
simple exchange pattern such as one-way, duplex and request/reply.
Example:
Endpoints will be mentioned in the web.config file on the created service.<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>
No comments:
Post a Comment