Difference between WCF And Web Service

Kailash Chandra Behera | Saturday, May 07, 2016

Introduction

Both Web service and WCF Service are used to developement service orianted application and data transfer over internet. But huge differents are there between Web service and WCF Service. This article present some measure differences exists between WCF Service and WEB Service.Below i have discussed the main differences between WCF Service and Web Service.

  • Attributes:

    WCF service is defined by ServiceContract and OperationContract attributes, whereas a web service is defined by WebService and WebMethod attributes.

  • Binding:

    WCF supports 9 types of bindings like BasicHttpBinding, WSDualHttpBinding, WSHttpBinding, etc., while a web service supports only two types of binding like XML and SOAP.

  • Duplex Service Operations:

    WCF supports duplex service operations apart from supporting one-way and request-response service operations, whereas a web service does not support duplex service operations.

  • Exception Handling:

    WCF handles exceptions by using FaultContract. They do not return to the client like in a web service.

  • Hash Table:

    As XML Serialization doesn't support hash table web service doesn't support to serialize. where as WCF service support to serialize a hash table.

  • Hosting:

    Web service can be hosted only in IIS, where as Various activation mechanisms are there for WCF hosting, i.e., IIS (Internet Information Service), WAS (Windows Activation Service).

  • Multi threading:

    ServiceBehavior class enables WCF service for supporting multi threading whereas there is no such concept in web service.

  • Protocols:

    WCF supports a range of protocols, i.e., HTTP, Named Pipes, TCP, and MSMQ, whereas a web service only supports HTTP protocol.

  • Serializer:

    Web service supports XML serialization whereas WCF service supports Datacontract Serialization.

Summary

Above are the discussion about WCF Service and Web Service, hope you have got the measure differences between WCF service and Web service and this discussion helped you to find out the differences.

Thanks