Before reading this article, I highly recommend reading the previous parts of this article:
- Introduction to WCF: Part 1
- Introduction to Endpoint in WCF: Part 2
- How to Make Changes to WCF Service Without Breaking Client in WCF: Part 3
- Method Overloading in WCF: Part 4
- What a DataContract and DataMember are in WCF: Part 5
- KnownType Attribute in WCF: Part 6
- MessageContract in WCF: Part 7
- Tracing in WCF: Part 8
- Exception handling in WCF: Part 9
- Centralize Exception Handling in WCF: Part 10
Before starting the example I am going to tell what binding is.
What WCF Binding is
Binding is a mechanism by which communication details are specified to make connection to a service endpoint. Each endpoint in WCF service requires a binding. Default binding is basicHttpBinding. Binding contain information about protocols, encoding and transport.
You can create your own custom binding as well. I will talk about this in later articles. According to MSDN, the most used common binding in WCF is:
- basicHttpBinding: This binding works only on http protocol. Best use of this binding is to convert web-services in WCF.
- wsHttpBinding: This binding basically does what basicHttpBinding does, but difference is this binding implements ws-* specification. It means wsHttpBinding = basicHttpBinding + security.
- NetNamedPipeBinding: This binding provide cross process communication on the same machine. This binding does not work across machines.
- NetMsmqBinding: This binding use MSMQ as transport. This is required when we have implemented some cross machine environment communication.
- WebBinding: This binding works only on http protocol. It is used when we try to implement restful services.
You can find more binding on MSDN link. It depends on our project requirement which binding suites my project. On behalf of that we choose the bindings. You can also create our own custom binding. For creating your own custom binding, click here.
Lets make a WCF application. In this application we are trying to add and divide numbers using WCF services. I am using Visual Studio 2012. Open Visual Studio and go to File, New, Project, then WCF and select WCF Service Application and name it wcfSevice.
Visual Studio provides some auto generated code. Let’s delete IService1.cs and Service1.svc file.
Add a wcf service file and name it MathService.svc and write the following code. It add the following two files.
- IMathService.cs
- MathService.svc
Delete all code of IMathService and write the following code.
- using System.ServiceModel;
- namespace wcfService
- {
- [ServiceContract]
- public interface IMathService
- {
- [OperationContract]
- int AddTwoNo(int FirstNo, int Second);
- [OperationContract]
- int DivideTwoNo(int first, int second);
- }
- }

Amit Kumar SinghPosted Sep 23, 2025, 9:35 AM
I have created CoreWCF Services in .Net Core.I am using SOAPUI to test the services.I am unable to test all services register in program.cs file. I need to comment 3 services out of 4 to test the services. Can anyone guide me, how to test all the service without commenting in program.cs file using SOAPUI
Pankajkumar PatelPosted Sep 13, 2019, 12:55 AM
Nice article
Gopi ChandPosted Sep 26, 2015, 2:47 PM
Great one
RakeshPosted Sep 26, 2015, 1:04 PM
Good one
Santhakumar MunuswamyPosted Sep 26, 2015, 12:12 PM
Nice share
Sujeet SumanPosted Sep 26, 2015, 11:55 AM
Nice Article..............
Harshad PansuriyaPosted Sep 26, 2015, 8:59 AM
Nice One Thanks For Share