WCF and Web Service both are used to create service for application. Compare to web service, WCF provide much more flexibility and portability to develop service oriented application.

There are following difference between both of them.

Hosting

Web Service: It can be hosted only on IIS (Internet Information Service).

WCF: It can be hosted in IIS (Internet Information Service), WAS (window activation service), Self Hosting and Window Service.

 

Attributes

Web Service: In Web Service, [WebService] and [WebMethod] attributes are used respectively with Class and Method.

WCF: In WCF, [ServiceContract] and [OperationContract] attributes are used respectively with Class and method which exposed to Client.

 

Protocols Support

Web Service: It supports only HTTP protocol for communication.

WCF: It supports HTTP, TCP, Named Pipes and MSMQ for communication.

 

Tools

Web Service: WSDL.exe tool is used to generate client for web service.

WCF: Service Metadata tool (svcutil.exe) is used to generate client for WCF service.

 

Operation

Web Service:  In Web Service for communication with application, it used One-Way and Request-Response operation.

WCF: But wcf supports One-Way, Request-Response and one more operation Duplex operation.

 

Serialization

Web Service: It uses xml serialization using System.Xml.Serialization namespace.

WCF: It uses DataContract serialization on runtime using System.Runtime.Serialization namespace.

 

Bindings

Web Service: It supports only SOAP or XML based binding.

WCF: It supports number of different type of binding like basicHttpBinding, wsDualHttpBinding etc.

 

Conclusion:

Today we learned main difference between a web service and wcf.

I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and if you like this post, please share it with your friends. Thanks