Understanding the basics of Windows Communication Foundation (WCF)

Understanding the basics of Windows Communication Foundation (WCF)

This article describes the basic concepts of Windows Communication Foundation (WCF). In this article I will explain What is WCF, advantages of WCF, What are ABC's of  WCF, Features of WCF and difference between Web service and WCF.
 
What is WCF?
 
Windows Communication foundation (WCF) is a unified framework which provides secure, reliability, transacted and interoperable distributed application.
 
There were several ways of technologies present in earlier versions of visual studio.Webservice (ASMX) being used to share information from any platform to another , .NET Remoting being used to communicate between client and server in windows application, Enterprise service(DCOM) being used for any transacted communication or Message queuing used for any Queued model.
 
WCF brings together the functionality of all those technologies under a unified programming model. This simplifies the experience of developing distributed applications.
 
Advantages of WCF
 
  • WCF provides an efficient way of communication between applications.
  • WCF service can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
  • WCF can be hosted in many ways in IIS, in Windows service or self hosted.
  • WCF has integrated Logging mechanism.
  • WCF service provides better reliability and security compared to Web services.
 
Terms in WCF
 
A WCF service is exposed to the outside world as a collection of endpoints.
 
 Endpoint: Endpoint is a construct at which messages are sent or received (or both). Endpoint comprises of ABC’s
 
What are ABC’s of WCF ?
 
A. Address - Address is a location that defines where messages can be sent
B. Binding - Binding is a specification of the communication mechanism (a binding) that described how messages should be sent. In my previous article I described about Different types of binding in WCF.
C. Contract - Contract is a definition for a set of messages that can be sent or received (or both) . There are different types of contracts available in WCF   which I explained on another article.
 
Features of WCF
  1. Service Orientation
  2. Interoperability
  3. Multiple Message Patterns
  4. Service Metadata
  5. Data Contracts
  6. Security
  7. Multiple Transports and Encodings
  8. Reliable and Queued Messages
  9. Durable Messages
  10. Transactions
  11. AJAX and REST Support
  12. Extensibility
 Difference Between Web service and WCF
 
 Web Service
 WCF
 Can be hosted in IIS
 Can be hosted in IIS,Windows Process activation service (WAS), Self hosting
 Supports only HTTP protocol
 Supports HTTP,TCP, MSMQ, NamedPipes
 uses XMLSerilalizer for serialization.
Key Issues with XmlSerializer in serializing .NET types to xml are:
 
a.    Only public fields or    properties of the .NET types can be   translated to Xml.
b.    Only the classes that implement IEnumerable can be translated.
c. Classes that implement IDictionary, such as Hashtable cannot be serialized.
 WCF uses DatacontractSerializer which gives better performance
ASMX security is Limited.
  In WCF, there is no need to make much change in code for implementing the security model and changing the binding. Small changes in the configuration will make your requirements.
 
Summary
 
I hope this article help you to understand basic concepts of WCF. Please share your valuable feedback on this.
 
comments powered by Disqus

Related Articles