Wednesday, April 9, 2014

Difference between ASP.Net Web Service and WCF service

Sr. No
Features
ASP.net Web Service
WCF Service
1
File Format/Extension
ASP.net web services uses .asmx as a file extension.
WCF web service uses .svc as a file extension.
2
Hosting
ASP.net Web service can be hosted in IIS. As well as ASP.net WebService can be hosted outside of IIS like ASP.net web service can be hosted in a Windows Service.
WCF service is flexible because it can be hosted in IIS, Windows Activation Services(WAS), Managed Windows Services and It also supports Self-Hosting.
3
Transport Protocols/Binding
ASP.net Web service supports HTTP & TCP protocols along with custom binding.
WCF service supports HTTP, WS-HTTP, TCP, Custom, Named Pipes, MSMQ & P2P(Point to Point) etc.
4
Data Transformation
It uses XML serializer for Data Transformation.
WCF service uses DataContractSerializer for Data Transformation.
5
Serialization NameSpace
System.XML.Serialization
System.RunTime.Serialization
6
Supported Operations
The supported operations are only One-Way and Request-Response type.
The supported operations includes One-Way, Request-Response and Duplex.
7
Encoding
It uses following encoding mechanisms -
XML1.0, MTOM (Message Transmission Optimization Mechanism), DIME (Direct Internet Message Encapsulation)
It uses following encoding mechanisms -
XML1.0, MTOM, Binary
8
WebMethods and DataContract
Uses WebMethods to translate .Net FW types in to XML.
  • [WebService] attribute has to be added to into the class.
  • [WebMethod] attribute represents the method exposed to the client.
Uses DataContractAttributes and DataMemberAttribute to translate .Net FW types in to XML.
  • [ServiceContract] attribute has to be added to into the class.
  • [OperationContract] attribute represents the method exposed to the client.
9
Messaging
Asp.Net web service supports only SOAP(Simple Object Access Protocol) as messaging service.
WCF service can send/receive message through any transport protocol message format. However, by default it uses SOAP for communication.
10
Security
This is not much secured as compared to WCF. It is less secured to protect data between Server and Client. Certificates can protect the data but it is very complicated to use Certificates. For security, normally we use UserName/Password.
As compared to ASP.net web service, WCF services are more secured. WCF does not need IIS to run, it can run as a System Service on the Server, using a command ambient. We can say that WCF is a service and not a Web Service.
11
Performance
Performance wise web services are slower than WCF service.
WCF services are than WebService. The performance measures in terms of xml serialization.
12
Exception Handling
This returns all unhandled exceptions to the client as SOAP faults.
WCF does not returns unhandled Exceptions to the client as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to the Client for the purpose of debugging.
13
Limitations
  • Hash Table cannot be serialized.
  • Only public properties/fields can be serialized
  • The DataContractSerializer translate the Hash table into the XML.
  •  Public/Private properties/fields can be serialized.

1 comment:


  1. I have read so many posts scr888
    on the topic of the blogger lovers however this paragraph is really a nice paragraph, keep it up.

    ReplyDelete