ASP.NET Web API
For those that aren’t familiar with ASP.NET Web API it represents the joint efforts of the WCF and ASP.NET teams to create an integrated web API framework. You can get the bits and find articles, tutorials, samples and videos on the new ASP.NET Web API home page. There’s also a Web API forum on the ASP.NET site where the teams will monitor customer questions and discussions.
Daniel Roth, a Senior Program Manager on the ASP.NET team and he was kind enough to put together a Q&A session (which answered a few questions I had) so I thought I’d share his responses.
First, a little history. For several years now the WCF team has been working on adding support for REST. This resulted in several flavors of REST support in WCF: WCF WebHTTP, WCF REST Starter Kit, and then finally WCF Web API. In parallel the ASP.NET MVC team shipped support for building basic web APIs by returning JSON data from a controller. Having multiple ways to do REST at Microsoft was confusing and forced our customers to choose between two partial solutions. So, several months ago the WCF and ASP.NET teams were merged together and tasked with creating a single integrated web API framework. The result is ASP.NET Web API.
What is ASP.NET Web API?
ASP.NET Web API is a framework for building and consuming HTTP services that can reach a broad range of clients including browsers and mobile devices. It’s also a great platform for building RESTful services. ASP.NET Web API takes the best features from WCF Web API and merges them with the best features from MVC.
The integrated stack supports the following features:
- Modern HTTP programming model
- Full support for ASP.NET Routing
- Content negotiation and custom formatters
- Model binding and validation
- Query composition
- Easy to unit test
- Improved Inversion of Control (IoC) via DependencyResolver
- Code-based configuration
What does this mean for WCF Web API?
ASP.NET Web API is effectively the next version of WCF Web API. There will not be a separate release for WCF Web API and we will retire all WCF Web API content by the end of the year. Please post all future discussions to the new ASP.NET Web API forum.
Why change the name?
Web APIs have a foot in two worlds: the world of service orientation and the World Wide Web. We decided to align ASP.NET Web API with the rest of the Microsoft web platform, so we went with the brand that communicates this alignment. From a technical perspective we also decided to go with a new HTTP specific dispatcher instead of trying to carry forward the WCF dispatcher, so there is virtually no WCF code in the new stack.
Does this mean I have to host my web APIs in IIS?
You can continue to self-host your web APIs in your own processes just like you could with WCF. ASP.NET Web API is at its core a light-weight HTTP message handler pipeline that is host independent. Our current self-host support is actually based on the WCF HTTP transport, but you can host ASP.NET Web API on any HTTP host of your choosing.
How do I migrate to my WCF Web API code to ASP.NET Web API?
We have started putting together some migration guidance here and we will flesh out the guidance in the upcoming weeks.
Is ASP.NET Web API on NuGet?
Yes, you can find our new NuGet Packages here:
Will ASP.NET Web API support a test client and help page generation?
For the ASP.NET Web API Beta we focused on getting the right framework runtime in place. Unfortunately, this meant that we weren’t able to get the test client and help page support ported onto the new stack in time for Beta. We are working on these features and we expect to ship them before the final ASP.NET Web API release.
Will the source code be made available?
We will publish the source code in the upcoming weeks.