WCF vs WebService

This post quickly explains difference between WCF & WebServices.

1. Protocols:

  • Web service supports HTTP via SOAP.
  • WCF supports HTTP, TCP,MSMQ, UDP , Named Pipe and many custom formats  SOAP, JSON, REST etc

2. Security:

  • Web Service provides only transport level security.
  • WCF supports Transport Level , Message Level & Data Level Security.

3. Hosting:

  • Web Service can be hosted in IIS only
  • WCF  can be hosted on IIS, WAS- (Windows Activation Server) , Managed Windows Service. Also it can be self hosted ( windows form , console app )

4. Migration:

  • Any .net distributed applciation can be easily migrated to WCF with very fewer changes.
  • Not easily possible in Web Service.

5. Serialization:

  • In order to serialize a web service we need to explicitly specify serialization attributes using  XML Serialization
  • WCF incorporates  Serialization by default for exposed methods using WCFSerialization.