Thursday, 2 October 2014

WCF vs Web Services

Most useful and most asked question in 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 implementation of SOA (Service Oiented Architecture), both are SOAP based services.



WCF
Web Services
Multiple hosting option – IIS, Self Hosting, WAS Hosting
IIS hosting is only option
HTTP, TCP, MSMQ, Named Pipe protocol supported
Only HTTP protocol supported
Multiple message pattern like  XML, JSON, Plain Text format supported
XML is the only option to exchange message
WCF supports REST Pattern
Web service does not support REST
WCF has various contract like Operation Contract, Data Contract, Message Contract, Fault Contract
Web Services has Web Methods


Apart from 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.

In context of Exception handling WCF is better as they have a separate contract called Fault Contract to handle exception.

No comments:

Post a Comment