Quote for the Week

"Learn to enjoy every moment of your life"

Thursday, September 22, 2016

WCF vs ASP.NET Web API



I spent three months to learn the concepts of WCF and Web API,  what is difference between them and which one should to prefer for our application. Let's see :

WCF :


As we know WCF stands for Windows Communication Foundation which enables building services that supports multiple transport protocols (HTTP, TCP, UDP and custom transports) and allows switching between them where we can build secure, reliable service that can integrate across the platforms and inter operate smoothly.

Asp.net Web API  :


Well, it is also a framework that is used to make HTTP services. As you know, now a days we are using mobiles, tablets, apps and different types of services, so Web API is a simple and reliable platform to create HTTP enabled services that can reach wide range of clients. It is used to create complete REST services.

RESTful Services


REST stands for Representational State Transfer.  REST is an architectural pattern for creating services. REST architectural pattern specifies a set of constraints that a system should adhere some specific constraints like Client server communication , stateless, Cacheable, Uniform interface that will play GET, PUT,  POST, DELETE

By Default, Web API supports RESTful services and for WCF need to configure.You have an existing SOAP service, you must support but want to add REST to reach more client but it is more complicate to implement REST because WCF needs more configuration to set up and it is headache.

WCF over Web API


  • Choose WCF when you want to create a service that should support special scenarios such as one way messaging, message queues, duplex communication etc.
  • Choose WCF when you want to create a service that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transport channels are unavailable.
  • Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
  • Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iphone and tablets.



Hope you got cleared with which is best one to choose for your application.

Feedback or queries?

mail to : dotnetcircle@gmail.com



No comments: