Difference between WCF and Web Service


   In this blog I am listing few differences between WCF and Web Service. A lot from us gets confused which is the best out these two to use. Please have a look on the below table and find yourself what to choose and why.

WebService
WCF
         · WebService and WebMethod attributes are used for defining web service.
          · ServiceContract and OperationContract attributes are used for defining WCF service.
          · Support security but is less secure as compared to WCF.
          · Supports security, reliable messaging, transaction and AJAX and REST supports.
          · Supports XML serializer by using System.Xml.Serialization.
          · Supports DataContract serializer by using System.Runtime.Serialization.
          · Supports One-Way and Request-Response service operations.
          · Supports One-Way, Request-Response and Duplex service operations.
          · Web Services are slower than WCF
          · WCF are faster than Web Services.
          · Hash Table cannot be serialized. It can serializes only those collections which implement IEnumerable and ICollection.
          · Hash Table can be serialized.
          · Unhandled Exceptions returns to the client as SOAP faults.
         · Unhandled Exceptions does not return to the client as SOAP faults. WCF supports better exception handling by using FaultContract.
          · Doesn’t support multi-threading.
         · Supports multi-threading by using ServiceBehaviour class.
          · Supports XML and MTOM (Message Transmission Optimization Mechanism) message encoding.
         · Supports XML, MTOM, Binary message encoding.
          · Web Services are hosted in IIS by pointing the ASMX file to the virtual directory.
          
       · WCF provides more options for hosting,  It combines old hosting options with new ones like hosting on WAS. WCF applications can also be hosted in the following ways:
1)      Self-hosting
2)      Windows Service
3)      IIS and WAS

Comments

Popular posts from this blog

How to show enlarge image when mouse hover on image or link in Asp.Net(c#) using JavaScript

StateCode and StatusCode Values for mostly used entities in Microsoft Dynamics CRM 2013

How to add custom filter lookup field based on OptionSet field selection in Dynamics CRM.

go to top image