Microsoft introduced WCF in 2006 along with .NET Framework 3.0.Windows Communication Foundation (WCF) is a next generation platform from Microsoft for service oriented architecture.
WCF Service Introduction
A service is a self-contained logical representation of a repeatable activity or function. Services can be combined with other software applications that together provide the complete functionality of a large software application.
Windows Communication Foundation, in short WCF, is a platform for developing distributed application services.
What is the use of WCF?
WCF is a cross platform programming model to create service.Hence WCF service can be consumed by a wide range of client applications such as .NET, Java or other technologies.It supports a variety of protocol, encoding, security, etc. It is more secure compared to Web Services.
The Windows Communication Foundation supports more protocols for transporting messages than the Web services, .Net remoting etc.
Web services only support sending messages via the Hypertext Transfer Protocol (HTTP). Remoting supports message transfer via TCP.
In WCF Service, Interoperability (communication) between applications is the key point of consideration. Implement the service functionality once and configure the same service in very easy steps to support message transfer over various different protocols including HTTP, TCP, Named Pipes, MSMQ, IPC and even some custom protocols.
.NET remoting demands the service and consumer be in .NET, which is a major constraint for distributed enterprise applications. Even though Webservices provide application/language interoperability, it also has protocol limitations.
Prior to WCF, we have to write different types of service component modules to work over different protocols such as Webservices for HTTP, Remoting for TCP etc.
WCF got introduced to addresses this issue.It is possible to write a WCF service logic once and configure the same service for any protocol/message transfer support.
That means WCF services can replace what all of its predecessors components (COM, COM+, Remoting, Webservices etc.) can do.
One other great advantage of WCF over other services is that WCF support of duplex communication, both half duplex, and full duplex. Webservices has only the capability of the simplex mode of communication.
Getting started With WCF Service For Beginners
What Is Simplex, Half Duplex and Full Duplex Communication?
Features of WCF Sevices
- Better interoperability and advanced protocol supports
- Improved reliability and security
- Better code reusability and highly configurable
- Multiple modes of message transports and Encodings
- Multiple Message Patterns
- Transaction supports
- Durable Messages and Queued Messages
- AJAX and REST Support
- Can be hosted in different sorts of application types such as Console application, Winforms application, ASP.NET web applications, Windows services etc.
ABC in WCF
WCF Service exposes end points which clients can access. Endpoint of the WCF services need to be configured properly.
Endpoint ABC is Address, Binding, and Contract.
A for Address:
Address is the address of service, the URL where the service is hosted. We need to define the service address/URL inside the endpoint configuration.
B for Binding:
Binding defines the communication type with the service.That is, how the service will communicate the outer world and the type of protocol which will be used for the communication.
C for Contract
Contract means the task performed by the service. The contract is the actual operation performed by the service. The contract name needs to be mentioned inside the endpoint.
Endpoint is configured as below,
<endpoint address="ServiceUrl" binding="BindingType" contract="ActualContractName" />
So, that was a brief introduction to Basics of WCF services.I hope you have enjoyed this article Introduction To WCF Service. If you have any queries regarding Basics of WCF Services, feel free to comment below.