Please enable Javascript to correctly display the contents on Dot Net Tricks!

Difference between WCF and ASP.NET Web Service

  Author : Shailendra Chauhan
Posted On : 20 Mar 2014
Total Views : 116,042   
Updated On : 21 Mar 2014

.NET provides various options for creating services under .NET Framework. Before WCF, ASP.NET Web Services are used to ceate service in .NET Framework. Now WCF is the latest programming model for building and developing service-oriented application. WCF allows applications to communicate with each other in distributed environment. WCF is a set of technologies that covers ASMX web services, Web Services Enhancements (WSE), .NET Remoting and MSMQ. In this article, you will learn the differences between ASP.NET Web Service and WCF.

Difference between WCF and ASP.NET Web Service
ASP.NET Web Service
ServiceContract and OperationContract attributes are used for defining WCF service.
WebService and WebMethod attributes are used for defining web service.
Supports various protocols like HTTP, HTTPS, TCP, Named Pipes and MSMQ.
Supports only HTTP, HTTPS protocols.
Hosted in IIS, WAS (Windows Activation Service), Self-hosting, Windows Service.
Hosted only in IIS.
Supports security, reliable messaging, transaction and AJAX and REST supports.
Support security but is less secure as compared to WCF.
Supports DataContract serializer by using System.Runtime.Serialization.
Supports XML serializer by using System.Xml.Serialization.
Supports One-Way, Request-Response and Duplex service operations.
Supports One-Way and Request-Response service operations.
WCF are faster than Web Services.
Web Services are slower than WCF
Hash Table can be serialized.
Hash Table cannot be serialized. It can serializes only those collections which implement IEnumerable and ICollection.
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.
Supports XML, MTOM, Binary message encoding.
Supports XML and MTOM (Message Transmission Optimization Mechanism) message encoding.
Supports multi-threading by using ServiceBehaviour class.
Doesn’t support multi-threading.
What do you think?

I hope you will enjoy the both ASP.NET Web Service and WCF. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

Free Interview Books
24 SEP
Angular2 and Angular4 (Classroom)
08:30 AM-11:30 AM IST
23 SEP
MEAN Stack (Classroom)
8:30 Am To 11:30 Am
23 SEP
Microsoft Azure Infrastructure Solutions (Online)
08:00 PM-11:00 PM IST / 9:30 AM-12:30 PM CST
20 SEP
MEAN Stack (Online)
07:00 AM-09:00 AM IST
20 SEP
ASP.NET MVC with Angular4 (Online)
9:00PM- 11:00PM IST(+5:30GMT)
16 SEP
Angular2 and Angular4 (Online)
08:00 AM-10:00 AM IST(+5.30 GMT)
ASP.NET MVC with Angular4 (Online)
09:00 PM to 11:00 PM IST (+5:30 GMT)
22 AUG
ASP.NET Core with Angular4 (Online)
07:00 AM - 9:00 AM IST(+5:30 GMT)
19 AUG
MEAN Stack 2 (Online)
5:30 Pm - 7:00 PM IST (+5:30 GMT)
19 AUG
ASP.NET MVC with Angular4 (Online)
10:30 Am to 12:30 PM IST (+ 5:30 GMT)
19 AUG
NodeJS with Angular4 (Classroom)
04:00 PM to 07:00 PM IST (+5:30 GMT)
12 AUG
ASP.NET MVC with Angular4 (Classroom)
11:30 AM - 1:30 PM IST (+5:30GMT)
15 JUL
ASP.NET MVC with Angular4 (Online)
03:30 PM - 05:30 PM IST(+5.30 GMT)