WCF Introduction
WCF is a unified communication framework that integrates all the Communication frameworks like ASMC/WSE, .NET REMOTING, DCOM/COM and MSMQ into one logical model.
WCF increases the productivity in the sense that you learn only one programming model rather than learning multiple models as in the other communication frameworks describe above. Each one of them has its own programming model so if developers want to learn or work in any of them, they need to understand each framework programming model separately.
WCF Service Components
Each WCF service has three main components
- Address
- Binding
- Contract
Address
Bindings
Binding specifies how to send a message and which protocol is used i.e. SOAP, or how a client can communicate with the service. Bindings also specify security constraints and other options. Some of the built-in bindings that WCF provides and their usage scenarios are as follow.
| Binding Types | Usage Scenario |
| WebHttpBinding | For Restful Communication using Http |
| BasicHttpBinding | For SOAP Communication using Http |
| NetTcpBinding | For .Net-To-.Net(Cross Machine) Communication using TCP |
Based on requirements, you can create custom bindings too.
Example
- <configuration>
- <system.serviceModel>
- <services>
- <service name=”servicename”>
- <endpoint address=”http://server/servicename” binding=”webHttpBinding” contract=”IExampleService” /> ……… </service>
- </services>
- </system.serviceModel>
- </configuration>
Contract
Contract is an interface where you define the methods that you want to expose. Clients interact with services through contract.
Example
- [ServiceContract]
- public interface InterfaceName {
- [OperationContract]
- string Example(string name)
- }

Vamsi kPosted Oct 29, 2019, 1:15 AM
Hi Rehman,I am new to WCF , i am handling one WCF project, Locally wcf service is working but when we deployed same in the server it is not working when we check with the wcf test cleint. And client website is not able to consume service.We gave address,binding and contract correctly in client website.Can you please mention the steps how to publish wcf code using VS2015 and what are the important points to remember while deploying wcf service
Rehman ShahidPosted Oct 27, 2019, 3:59 AM
Hi Vamsi K, How i can help you?
Vamsi kPosted Oct 20, 2019, 8:40 PM
Hi Rehman Shaid,