Before we delve into the building blocks and design principles behind ASP.NET Web API, it is important to understand that ASP.NET Web API is an evolution of the existing continuous Microsoft efforts to enable support for HTTP Services. A timeline of events that describe this evolution are outlined next.
Windows Communication Foundation (WCF) (https://msdn.microsoft.com/en-us/library/ms731082%28v=vs.110%29.aspx) was launched with .NET 3.0 for SOAP-based services; the primary aim was to abstract the transport layer and enable support for the WS-*
protocol. No HTTP features were enabled except HTTP POST
for requests
In NET 3.5, WebHttpBinding
(https://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding%28v=vs.110%29.aspx) was introduced in WCF with the intent to support services that were not based on SOAP. It allowed systems to configure endpoints for WCF services that are exposed through HTTP requests instead of SOAP messages. The implementation was very basic and most HTTP protocol features were still missing or needed to be coded separately.
WCF Starter Kit (https://aspnet.codeplex.com/releases/view/24644) preview was launched to provide a suite of helper classes, extension methods, and Visual Studio project templates for building and consuming HTTP REST-based services. A new WebServiceHost2
type was added to host RESTful services. Also, client HTTP support was added to provide a more natural experience for HTTP programming. The project never got released and eventually migrated into WCF Web API. As of August 2009 the project is in preview status.
During the same time, ASP.NET released some basic support to create REST APIs with its .NET 4.0 release. Its capabilities were limited, and HTTP features such as content negotiation were not available. ASP.NET was still targeted towards building web applications.
WCF Web API (http://wcf.codeplex.com/wikipage?title=WCF%20HTTP) was technically the first attempt to create a framework to support HTTP services from the ground up. However, the development efforts still leveraged pieces from WCF REST Starter Kit and .NET 3.5. A new rich, high-level HTTP programming model was adopted that included full support for content negotiation. A variety of traditional formats were supported (XML, JSON, and OData), and server-side query composition, ETags, hypermedia, and much more was enabled. The development was simplified by introducing the use of HttpRequestMessage
and HttpResponseMessage
to access requests and responses. The WCF Web API's second release was compatible with ASP.NET and allowed registering routes for Web APIs similar to ASP.NET MVC.
The WCF Web API project merged with the ASP.NET team to create an integrated Web API framework, and ASP.NET Web API was born. It shipped with the MVC4 Beta release in February 2012 and went to RTM in August 2012.
ASP.NET Web API 2 was released in October 2013 with new features such as attribute routing and authorization with OAuth 2.0. Another version, 2.1, was released in January 2014 with improvements to the existing infrastructure and additional features such as global exception handling.
At the time of writing, ASP.NET Web API 2.2 is the current stable version of the ASP.NET Web API framework. It includes more improvements to existing features such as enabling client support for Windows 8.1 devices along with bug fixes.