WCF vs Web Services

Most useful and most asked question in an interview is WCF vs Web Services.
It could be asked in various form like Why WCF is better than Web Services

WCF and Web Services both are the implementation of SOA (Service Oriented Architecture), both are SOAP-based services.

WCF supports other formats as well apart from SOAP but Web Service support SOAP only.

As we know there are various techniques to create distributes system. Some of them are Web Service,.Net Remoting.

Sometimes there may be the scenario that which technology should we use to develop a distributed application. And if there is a requirement for enhancement then how difficult would it be to switch over among technologies.

WCF is the solution for all these queries. WCF is the unified technology to create a distributed system which is not dependent on OS platform, Protocols to use and many more.

Let’s look at differences between WCF and Web Service.

Read this - What is Microservice Architecture?
WCF
Web Service
Multiple hosting options – IIS, Self Hosting, WAS Hosting
IIS hosting is the only option
HTTP, TCP, MSMQ, Named Pipe protocol supported
HTTP and HTTPS only
Multiple message pattern like  XML, JSON, Plain Text format supported
Support XML only.
WCF supports REST Pattern
Web service does not support REST
WCF has the various contract like Operation Contract, Data Contract, Message Contract, Fault Contract
Web Services has Web Methods
WCF was released in .Net framework 3.0
Web Service was released in ASP.Net 2.0
WCF uses ServiceBehavior class to support multithreading
Web Service does not support multi-threading
WCF service uses [Servicecontract], [OperationContract] attributes
Web Service uses [WebMethod] attributes
Apart from the above-mentioned point, there are more differences like,
To generate service model class SVCUTIL.EXE tool is used however for Web services WSDL.EXE is used.

Leave a Comment

RSS
YouTube
YouTube
Instagram