WCF or Windows Communication Foundation is a platform which is used to create distributed application service. It is a cross platform application that means WCF service can be used by client which is created in .NET technology or java technology or any others. WCF is also known as Indigo (this was its earlier name), but when it introduced with .NET Framework, it is known as WCF.
WCF is introduced with .NET Framework 3.0 by Microsoft in 2006.

See the above image; you can see that WCF is a common technology that provides all the features of the above technologies.
What is the use of WCF?
WCF is a programming model to create service which can be accessible to a wide range of client. It supports variety of protocol, encoding, security, etc. It is more secure compared to Web Services.
Example:
Let take an example, if you create a service for your client which use HTTP protocol to communicate the service. So, let's assume you created your service using Web Service. It is supposed that in future the other client ask for the same service, but he/she is using the TCP Protocol, So, what will you do here.
Here you need to do one more effort to create a new service for new client as per the requirement. So, you did double effort for the same service.
Here WCF comes and resolve this problem. If you choose WCF service, then you can expose your service to number of clients without creating any new service or new development.
You just need to make some configuration changes to expose the service to a particular client.
ABC in WCF
ABC stands for Address, Binding and Contract. If you expose your service to a new client, then you just need to add ABC in configuration.
- <endpoint address="ServiceUrlGoesHere" binding="TypeOfBinding" contract="NameOfContract" />
A stands for Address: Address means, the address of service. I mean to say where you hosted your service which is going to expose. You just need to define your service address inside the configuration.
B stands for Binding: Binding means how your service will communicate the outer world and which protocol will be used by the client to access the service?
C stands for Contract: Contract means what task is done by service. We need to define contract name inside the endpoint which describe that which are the operations done by the service.
- <endpoint address="http://localhost:8731/DemoService/" binding="basicHttpBinding"
- contract=" DemoService.IDemo">
Contracts in WCF
Contracts are very useful to make a WCF service application. It defines what type of protocol does service use, what type of operation will be done by the service, what type of data will be sent over the protocol.
Here are theg Contracts which are available in WCF:
- Service contracts
- Data contracts
- Message contracts
- Fault Contract
- Operation contract
Service contracts
Service contract describes about all the operations which we will perform by the service. It can be an Interface or a class, I suggest always use an Interface rather than a class because of security purpose. [ServiceContract] attribute is used to define the service contract.
- [ServiceContract]
- public interface IMyService
- {
- // All the Operation goes here
- }
Operation contract defines all the action or we can say method/function which will execute by service when client will consume it. These methods are used to exchange the data between client and service. You need to use [OperationContract] attribute to define the operation contract in WCF.
- public interface IMyService
- {
- [OperationContract]
- string GetData(int myValue);
- [OperationContract]
- int AddData(int first, int second);
- }


Mukesh KumarPosted Oct 18, 2015, 5:57 AM
Thanks Sir
Santhakumar MunuswamyPosted Oct 18, 2015, 5:47 AM
Good one
Mukesh KumarPosted Oct 16, 2015, 5:47 AM
Thanks Yudi and Suman
Suman VermaPosted Oct 16, 2015, 5:43 AM
Nice article
Yaduveer SainiPosted Oct 16, 2015, 5:38 AM
Great job
Banketeshvar NarayanPosted Oct 16, 2015, 3:34 AM
Great job.. Keep it up!
Mukesh KumarPosted Oct 7, 2015, 2:02 PM
Thanks Ugur
Ugur BaykocPosted Oct 7, 2015, 1:58 PM
Thanks very useful article.
Vipul MalhotraPosted Oct 7, 2015, 1:10 PM
nice info
Priyaranjan K SPosted Oct 7, 2015, 11:02 AM
Nice Share ...
Mukesh KumarPosted Oct 7, 2015, 1:34 AM
thanks Ankit
Ankit BansalPosted Oct 7, 2015, 1:28 AM
nice..thanks for sharing knowledge..
Sibeesh VenuPosted Oct 7, 2015, 12:57 AM
Nice Share
Mukesh KumarPosted Oct 7, 2015, 12:39 AM
Thanks Humayun
Humayun Kabir MamunPosted Oct 7, 2015, 12:07 AM
Nice...
Mukesh KumarPosted Oct 6, 2015, 10:33 PM
Thanks
Nilesh JadavPosted Oct 6, 2015, 9:21 PM
Good info on WCF