Windows Communication Foundation (WCF) a set of APIs under.NET Framework for developing connected and service-oriented applications. It is developed by Microsoft that is used to build service-oriented applications. Earlier it used to be known as Indigo. Through WCF, you can establish communication channels using MSMQ, Remoting etc. Using it, you can send data as asynchronous messages from one service endpoint to another.
Components of WCF are service class, end point and hosting environment.
In WCF, the end point is the address where a message is to be sent or received. WCF client connects to WCF service through an endpoint. It also explains how the messages will be sent with the set of messages. It has three properties which are address, binding and contracts.
Yes, WCF supports interoperability with WCF applications on the same Windows machine or on a different Windows machines or on platforms such as Java running on Windows or even other operating systems.
WCF has following features -
WCF has following advantages -
WCF Service - Windows Communication Foundation (WCF) a set of APIs under.NET Framework for developing service-oriented applications. ServiceContract and OperationContract attributes are used for defining WCF service. WCF service supports HTTP, WS-HTTP, TCP, Custom, Named Pipes, MSMQ & P2P (Point to Point) etc. protocols. It can be hosted on IIS, WAS (Windows Activation Service), Windows services or Self hosting. WCF services are more secured than those of ASP.NET Web Services because WCF does not need IIS to run, it can run as a System Service on the Server. It supports One-Way, Request-Response and Duplex service operations. Hash Table can be serialized.
ASP.NET Web Services - Web service is a technique to provide data as a service/response over the HTTP protocol on request of any other program. WebService and WebMethod attributes are used for defining web service. It supports HTTP & HTTPS protocols. Hosted only in IIS. It is less secured as compared to WCF to protect the data between Server and Client. The supported operations are One-Way and Request-Response type. Hash Table cannot be serialized.
Following 4 types of contracts are available in WCF-
A data contract is an exchange of data agreement between a service and a client. For security purpose, we serialize the messages sent across the wire “[DataContact]” attribute given at class level to serialize the class by using “[Datamember]” attribute over properties. It defines the external format of data passed to and from service operations.
Service contracts give details of the operations that the services will perform Service Contracts can be defined like –[ServiceContract]. It links the interface and methods of the service to a platform-independent description. Some of the service operations are one-way; some may have request-response operations.