Hello Friends, In this tutorial, I am going to tell you what is WCF and the advantages of using it. WCF is a framework that can be used to create a service-oriented application.

After completing this tutorial you will be able to understand:

  • What is WCF?
  • Components of WCF.
  • Advantages of WCF.
  • Scenarios where WCF can be used?

Introduction:

WCF stands for Windows Communication Foundation. WCF is a programming model for building distributed application and interoperable application. A distributed application is one where the part of the application runs on two or more computer nodes. WCF is used to create a service-oriented application that can be used by multiple clients. WCF can be used to send asynchronous messages from one end point to another end point. The end point can be a client such as a browser, an iPhone, a tablet of a service that requests data from a service endpoint. WCF is used to create a service that is accessible to Windows, Linux or any other devices.

WCF

Scenarios where WCF can be used?

  • A Secured service that needs to perform some business transaction.
  • A Service that delivered some data to other application such as whether report.
  • A Service that exchanges data between two or more peoples for communication.
  • A service that needs to used by the browser as well as Mobile devices.

Fundamental Terms of WCF.

EndPoint:

When we create a WCF Service it exposes a collection of EndPoints. This EndPoint is responsible for communication with Clients that is consuming the service. The EndPoint is the address which is used to send or received the message.

The EndPoint has the following major component:

1- Address:

The address is the location where your service is hosted as URL. This URL is used by the client to build communication between service and client.  An example of Address is

2- Binding:

The binding specifies the protocol that will use to build communication with the specified end point.

3- Contract:

It specifies the functionality that the endpoint is going to expose. The contract contains the name of the Interface.

Below is the example of EndPoint:

Message:

A message is a communication unit which is sent and received from the client. It contains the body, headers and many other several parts.

Channel:

If your Service was the human body, channels would be the sensory nerves of your Service. Sensory nerves carry messages from receptors in your body to your brain. Sensory messages pass through multiple nerves on the way to the brain.

Channels act as sensory nerves between the service and clients. It is used to carry messages between service and clients. There are two types of channel.

1- Transport Channel:

Transport Channel handles the communication over the wire. It transfers messages between service and client using Transport protocol. It supports protocols like TCP, HTTP, MCMQ.

2- Protocol Channel:

It is used to implement security to implement security, transaction and reliable messaging.

Hosting:

It specifies the hosting such as Self Hosting, IIS hosting, WAS Hosting and Windows Service Hosting.

WCF Client:

It is the client application which is used to expose the service operations in form of method.

MetaData:

The metadata can be used to automatically generate and configure clients for accessing WCF services.  We can enable the ServiceMetadata node inside the serviceBehavior node of the service configuration file.

Advantages of WCF Service:

  • The main feature of WCF is interoperability
  • It provides better security as compared to web service
  • No need to make a big change for security.
  • It is language independent.
  • It is Location independent.
  • WCF can control Concurrency issue.

Conclusion:

Hope you understand this important tutorial about WCF in .NET and what is the advantages of it.  I will appreciate your feedback, comments, and suggestions.

View More:

Thank You.

 

Leave a Comment