Basic points to know about WCF service!

  • System.ServiceModel is the core assembly of the WCF service.
  • All the WCF attributes and classes are present in the System.ServiceModel assembly.
  • Two files are created with .cs extension while creating a WCF application. One file is an interface and the other is the class file.
  • The interface file is decorated with [ServiceContract] attribute which means this interface is available for the service.
  • Inside the interface file, there are method declarations which can be decorated with the attribute [OperationContract] . This attribute says if you want a method to be available for clients then decorate it with [OperationContract] .

Why do we need WCF?

  • With the help of WCF, we can satisfy the different clients developed with different technologies like Java, .NET etc. with a single WCF service to fulfill their requirement.
  • Different clients may need requirements in different formats. That is one client may need in XML format and another may need in Binary Message Format. This requirement can be achieved with the help of WCF service.
  • Even WCF services support different protocols like http, tcp etc.