Please Subscribe Youtube| Like Facebook | Follow Twitter
In this article we will discus about WCF, Web API and their difference.
What is WCF?
WCF was first introduced with .NET 3.0 framework. WCF is stand for Windows Communication Foundation. It is a framework used for building distributed systems. Using WCF we can achieve request-response, simplex, half duplex or full duplex communication. WCF can support multiple protocols which mean it can be use via HTTP, TCP, UDP or IPC.
What is ASP.NET Web API?
ASP.NET Web API was first introduced with .NET 4.0 framework. It is a framework used for building HTTP based services that can be accessed on web, windows, mobile etc. It almost works same as ASP.NET MVC web application except that it sends data as a response instead of html view.
Difference between WCF and ASP.NET Web API?
- Web API supports both REST and SOAP services but it is ideal for developing restful services, on the other hand WCF was originally created to enable SOAP-based services but it also supports REST services with limitations.
- WCF Supports multiple Protocols i.e HTTP, TCP, UDP and IPC but Web API supports only HTTP protocol.
- Web API Supports MVC feature i.e routing, controllers, action and results but WCF does not.
- Both Supports multiple data formats.
- Web API is based on request/response but additional patterns can be supported through SignalR and WebSockets integration while WCF Supports Request-Reply, Half and full Duplex communication.
- Both can be hosted with in the application or on IIS but WCF can also be hosted using windows service.
- Web API is light weight architecture so it is good for devices which have low bandwidth like mobile devices.
- For quick development, Web API is better choice than WCF.
- WCF supports more security options i.e WS-Security W3C standard but Web API can also be secured by using different security practices such as encryption.