Monday, 8 September 2014

Difference between WCF and ASP.NET Web Service

WCF
ASP.NET Web Service
1.       ServiceContract and OperationContract attributes are used for defining WCF service.
WebService and WebMethod attributes are used for defining web service.
2.       Supports various protocols like HTTP, HTTPS, TCP, Named Pipes and MSMQ.
Supports only HTTP, HTTPS protocols.
3.       Hosted in IIS, WAS (Windows Activation Service), Self-hosting, Windows Service.
Hosted only in IIS.
4.       Supports security, reliable messaging, transaction and AJAX and REST supports.
Support security but is less secure as compared to WCF.
5.       Supports DataContract serializer by using System.Runtime.Serialization.
Supports XML serializer by using System.Xml.Serialization.
6.       Supports One-Way, Request-Response and Duplex service operations.
Supports One-Way and Request-Response service operations.
7.       WCF are faster than Web Services.
Web Services are slower than WCF.
8.       Hash Table can be serialized.
Hash Table cannot be serialized. It can serializes only those collections which implement IEnumerable and ICollection.
9.       Unhandled Exceptions does not return to the client as SOAP faults. WCF supports better exception handling by using FaultContract.
Unhandled Exceptions returns to the client as SOAP faults.
10.   Supports XML, MTOM, Binary message encoding.
Supports XML and MTOM (Message Transmission Optimization Mechanism) message encoding.
11.   Supports multi-threading by using ServiceBehaviour class.
Doesn’t support multi-threading.

No comments:

Post a Comment