Overview Of WCF

What is WCF

WCF or Windows Communication Foundation is a programming model to create service oriented application. It is used to create and deploy the service that is accessible to lots of different clients. It provides an environment where you can create a service which can be accessible to windows client as well as Linux client or any others. It provides more features compared to web services.

WCF is a Microsoft technology to create service oriented application. Before the WCF, the Web Service was used to create services but that type of service is only accessible to Windows client hosted on HTTP protocol. But WCF services are accessible with different protocols like http, tcp, msmq, etc.

WCF

WCF vs. Web Services

Web Service and WCF Service both are used to create service and these services are consumed by some other clients. Web Service was more demanding when WCF was not introduced, but nowadays WCF is in market because of its features and interoperability.

The following are the differences between WCF and Web Service.

  1. Web Service can be hosted on IIS. We cannot host Web Service any other place besides IIS but WCF enabled services can be hosted on IIS, WAS [Windows Activation Service], Windows Service. We can also host our WCF services as self-hosting. So, WCF provide more options as compared to web services to host services.

  2. Web service performs only two types of operation, first one is One-Way and other one is Request-Response. But compared to web service, WCF service performs one different type of operation and it is Duplex Operation.

  3. As we know that serialization is most important of SOA. We always want to send our data as secure to outer world. To make secure data over internet, serialization is used to encrypt the data. Web Service uses xml serialization but WCF uses Runtime serialization.

  4. Web Service uses XML, MTOM and also supports custom encoding. WCF supports all types of encoding which is supported by web service. WCF supports binary encoding as well.

  5. As we know, services are accessed using some protocol like http, tcp,   etc. Web Service are only HTTP enabled service. But WCF service supports different type of protocol like HTTP, TCP, MSMQ, and NAMED PIPES, also Custom Protocol.

WCF vs. Web Services

End Points

When we create any service, there is some configuration required to expose the service to outer world. So, we need to define the Address of service, Type of Binding and also define how the client will access the service. These include and called Endpoints. Endpoints are collection of configuration which tells that which type of client will consume your service and how they are able to connect with your service. So, basically Endpoints are the collection of Address, Binding and Contract.

EndPoint is theme of ABC

A stands for Address. In the configuration setting of the service we define the Address of the service. Address is hosted location of the service. So, basically it is url of the hosted service.

Address can be local hosted url or server hosted url.

B stands for Binding. It describes how your services will bind or communicate with client in real world. There are different types of protocol available which is used to communicate with client.

Binding contains Transport, Encoding and Protocol. WCF binding supports different types of binding which is necessary to communicate with different type of client. Some client uses WCF service as Web Service, so in that scenario basicHttpBinding is used. If a client want to use Security feature then they can use WSHttpBinding.

C stands for Contract. Contract is nothing but only a collection of operation which is defined in Service. In the contract section of configuration setting basically we define the name of interface. We can define the name of class but it is better practice to pass interface name for security purpose. Every operation defined in the contract perform some operation and it can be one way, request response or duplex.

EndPoint

  1. <services>  
  2.     <service name="MathService" behaviorConfiguration="CallServiceBehavior">  
  3.         <endpoint address="http://localhost:8090/MyService/CallService.svc" contract="ICallService" binding="wsHttpBinding" /> </service>  
  4. </services>  
Thanks for reading this article, hope you enjoyed it.

 

Up Next
    Ebook Download
    View all
    Learn
    View all