Setting up a self-hosted ASP.NET web API
In this recipe, we will demonstrate how to self-host an ASP.NET web API. A web API gives us the flexibility to host our web API in our process, also called self-hosting.
Getting ready
In order to use this recipe you should have Visual Studio 2012 and ASP.NET MVC 4 installed (the latter includes the ASP.NET Web API).
How to do it...
Next we are going to self-host our web API.
- Create a new console application project and name it
WebAPISelfHosted
. - Open the NuGet package manager, which you can launch from the Tools menu, select Library Package Manager, and click on Manage NuGet Packages for Solution.
- Select the online packages, and look for Microsoft ASP.NET Web API Self Host and click on Install as shown in the following ...
Get Microsoft .NET Framework 4.5 Quickstart Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.