Kailash Chandra Behera | Monday, August 15, 2016


We all are know that WCF is best for Service oriented programming and it supports high level protocols, security. This article explains the when should we use Web API instead of WCF service.

Getting Started

Before starting how to work with Web API, I would like to describe the situations that will help developers to choose Web API for service-oriented applications. There are many cases that will force developers to use Web API instead of WCF service.

First Case, ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. It means in practical developers should use Web API when to let’s say there is a function that contains some business logic and data process, that function is used by both web client and mobile client.

When your service-oriented programming does not require high-level protocol rather than only HTTP protocol, because Web API supports only HTTP protocol, and application requires only limited media types like TEXT, JSON, XML, etc.

ASP.NET Web API should be used if you are creating and designing new REST-style services. Although WCF provides some support for writing REST-style services, the support for REST in ASP.NET Web API is more complete and all future REST feature improvements will be made in ASP.NET Web API.

When you want to create a resource-oriented service over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats and when you want to expose your service to a broad range of clients including browsers, mobiles, iPhone and tablets.

Use ASP.NET Web API when high-level security like Message Security and multiple message pattern does not require because HTTP is request/response but additional patterns can be supported through SignalR and WebSockets integration.

Related Articles

  1. Difference Between DataContractSerializer and XMLSerializer
  2. Getting Client's IP Address in WCF Service
  3. Consuming Restful API with Bearer Token Authentication using HttpWebRequest
  4. Concurrency Mode In WCF
  5. Difference between WCF And Web Service


In this article we have discussed the situations to use ASP.ENT Web API, The next part of the article I am going to demonstrates how to create Web API. Hope this artcile may helpful to you.