Feature
|
Asp.net
Web service (ASMX)
|
WCF
Service
|
Hosting
|
Supports only IIS hosting.
|
You can use IIS, self hosting, Windows
activation service (WAS), Windows Service.
|
Performance
|
Slower compared with WCF
|
Faster than asp.net web service.
It performs better over XmlSerializer
since, DataContractSerializer shows which properties or fields, actually
translated (or serialized) into XML.
|
Implementation
|
ASMX services are defined using two
attributes namely the [WebService] and [WebMethod] in a Class.
|
WCF services are defined using two
important attributes called the [ServiceContract] and [OperationContract], typically
these attributes used with interface.
|
Security,
Reliability and transaction support
|
Support security but is less secure as
compared to WCF.
|
Supports security, reliable messaging,
transaction and AJAX and REST supports.
|
Multithreading
Support
|
Doesn’t support multi-threading.
|
Supports by using ServiceBehaviour class.
|
Message
exchange pattern support
|
Supports One-Way, Request-Response
service operations only.
|
Supports One-Way, Request-Response and
Duplex service operations for message exchange.
|
Protocols
|
Supports only HTTP and HTTPS.
|
Supports protocols like HTTP, HTTPS,
TCP, Named Pipes and MSMQ.
|
Exception
handling
|
Unhandled Exceptions returns to the
client as SOAP faults.
|
Supports better exception handing by
using FaultContract.
|
Serialization
|
ASMX web service would use
XmlSerializer attribute for data conversion.
It is only capable of serializing public
properties or members.
|
WCF service uses the
DataContractSerializer Class to translate data into XML by using the
System.Runtime.Serialization.
|
Hash Table
|
XmlSerializer cannot translate data in an
Hashtable() into XML.
|
DataContractSerializer can translate
Hashtable() data into XML.
|
Easy
|
Easy and simple to write and configure
but not dynamic, example: if changes service URL require more changes
compared to WCF.
|
Easy
,reliable and portable for new changes.
|