This blog basically deals with the detailed explanation of Windows Communication Foundation and its basic concept. We all know that WCF is a very useful functionality for every mobile and web application. A lightweight and secure application can be built by different end users using WCF.

About Windows Communication Foundation (WCF)

Windows Communication Foundation has its code name Indigo. Windows Communication Foundation is a programming platform, which allows the creation of new service and runtime system for building, configuring and deploying network-distributed services. Actually, WCF is latest service-oriented technology.

The most fundamental characteristics of WCF is Interoperability. Actually, the windows communication foundation is a unified programming model provided in .Net Framework 3.0. Basically, WCF service is a combined feature of Web Service, Remoting, MSMQ as well as COM+. The WCF service provides a common platform for all .NET communication. We can create WCF application using Microsoft visual studio latest version.

Source: dotnet-tricks.com

The WCF service supports different technologies.For example refer to the below figure to know the difference:

Advantages of WCF

Actually, WCF is interoperable with other services in comparison to .Net Remoting, whereas the client and service both have to be on .Net.

The WCF services provide us better reliability and better security in comparison to ASMX web services.

Actually, WCF service can be termed as the most secured service. That’s why in WCF, there is no need to make more change in the source code for implementing the security model as well as changing the binding. We do small changes in our configuration file and its make our service more secure.

WCF has integrated logging mechanism, changing the configuration file settings will provide this functionality. Basically, in other technology, the developer has to write the code.

Disadvantages of WCF

In WCF according to our requirement, it is very difficult to make right design. It is a little bit difficult.

Difference Between WCF and Web Services

The web service is a part of WCF. The WCF service provides much more flexibility and portability for service development in comparison to web services. That’s the reason it is mostly used by the users. The WCF and web service has much difference. WCF service is the latest service that provides more advantages over Web service.

See table below provides a detailed difference between them:

Features

Web Service

WCF

Hosting

Basically,It can be hosted in IIS

Actually,It can also be hosted in IIS, windows activation service, Self-hosting, Windows service

Programming

[WebService] attribute set on the top of a class.

[ServiceContraact] attribute has set on the top of a class.

Model

[WebMethod] attribute refers the service method that exposed to the client

[OperationContract] attribute refers the service method that exposed to the client

Operation

One-way, Request-Response are the different operations supported in web service

One-Way, Request-Response as well as Duplex are different type of operations supported in WCF

XML

System.XML.serialization namespace is used for serialization

Actually,System.Runtime.Serialization namespace is used for serialization

Can be accessed through HTTP, TCP, Named pipes, MSMQ, P2P as well as Custom

Protocols

Security

Security, Reliable messaging as well as Transactions

Different Types of WCF bindings

The windows communication foundation uses built-in bindings to fulfill users specific requirement. A custom binding is used in many ways for goal fulfillment.

We have used System.ServiceModel Namespace for all inbuilt bindings in WCF. Actually, ten built-in bindings are used in WCF:

1. Basic binding

Actually, in the basic binding, we are using the BasicHttpBinding class. This service uses ASMX service as WCF service. Now our older service which is using ASMX web service can consume new service.

This binding by default used HTTP as well as HTTPS protocol using Http protocol for transport and encode the message in UTF 8 text format. Basic binding also allows the use of Https.

2. Web binding

The web binding is designed for services as an Http request by using HTTP-GET as well as HTTP-POST. Inputs including XML or JSON format can be easily derived with the use of this binding along with REST-based services.

This is very much used with social networks for implementing a syndication feed. Consequently, in this binding, we are using WebHttpBinding class.

3. Web Service (WS) binding

The web service bindings provide us with many WS – * specifications including WS – Reliable Messaging, WS – Transactions, WS – Security and many more, which are in support by Basic binding. This binding is a combination of basic binding and web service specification.

In web service binding we use the WSHttpBinding class. This service is same as Basic binding and uses Http as well as Https protocols for transport.

For example:- wsHttpBinding= basicHttpBinding + WS-* specification

4. WS Dual binding

In web service dual binding we use the WsDualHttpBinding class. Web Service dual binding supports bi-directional communication. It allows the clients and services to send and receive messages. Rest, this functionality it is similar to wsHttpBinding.

5. TCP binding

In fact TCP binding, we are using the NetTcpBinding class. TCP protocol uses this binding for communication between two machines on the same network. This binding encodes the message in binary format.

The TCP bindings are much faster and more reliable binding as compare to the other and Http protocol bindings. This service offers a WCF to WCF communication for client and service provider.

6. IPC binding

This binding uses named pipe for Communication between two services on the same machine. The IPC binding is the most secure as well as fast binding as compared to all the bindings. Infact IPC binding uses NetNamedPipeBinding class for its processing.

7. MSMQ binding

This binding is using MSMQ for transport and offers support to disconnected message queued. In this bindings, infact we use the NetMsmqBinding class. The MSMQ binding is very useful bindings because it gives us facility for disconnected scenarios in which service processes the message at a different time in comparison with the message time send by the client.

8. Federated WS binding

This is a specialized form of web Service binding as well as provides support to federated security. Infact in this bindings, we use the WSFederationHttpBinding class.

9. Peer Network binding

In peer network binding we are using a NetPeerTcpBinding class. This binding uses TCP protocol because it uses peer networking as a transport. In this networking, each node acts as a client as well as a server to the other nodes. The tool named torrent uses this binding service cause of the file-sharing systems.

10. MSMQ Integration binding

Infact MsmqIntegrationBinding class uses the format of MSMQ integration binding. This binding offer support to communicate with existing systems that communicate via MSMQ.

Concluding Words…

I hope this article will help you understand about Windows Communication Foundation, its advantages and bindings types. In my next blog, I will describe WCF architecture, service-oriented architecture concept and other things.