What Is ASP.NET Web API and How does it Work?

If you navigate to the ASP.NET site, you will find the following statement.

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. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.

You can find info on ASP.NET Web API ranging from articles, blog posts, Channel 9 videos to code samples.


As you become familiar with ASP.NET Web API, questions like, “What really is ASP.NET Web API?”, “How is it related to or different from ASP.NET, ASP.NET MVC and WCF?”, “When do you use WCF vs. ASP.NET Web API?” I came across one codeproject article, “WCF or ASP.NET Web APIs? My two cents on the subject”, written by Ido Flatow a few months ago that provides a historical perspective of what is ASP.NET Web API and how it evolves to be what it is today. His conclusions are as follows.

  • If your intention is to create services that support special scenarios – one way messaging, message queues, duplex communication etc, then you’re better of picking WCF
  • If you want to create services 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 transports are unavailable, then you’re better off with WCF and using both SOAP-based bindings and the WebHttp binding.
  • If you want to create resource-oriented services over HTTP that can use the full features of HTTP – define cache control for browsers, versioning and concurrency using ETags, pass various content types such as images, documents, HTML pages etc., use URI templates to include Task URIs in your responses, then the new Web APIs are the best choice for you.

Great article! I highly recommend that you take a look at it.