Creating our first ASP.NET web API

In this recipe, we will see how to expose a basic service and some data through HTTP with the ASP.NET web API.

Getting ready

In order to use this recipe, you should have Visual Studio 2012 and ASP.NET MVC 4 installed (the latter one includes the ASP.NET web API).

How to do it...

Next we are going to create a web API:

  1. To start, open Visual Studio 2012, select the web category from the visual C# categories and use the ASP.NET MVC 4 Web Application template to create a new project. Name it WebAPI101.
  2. On the New ASP.NET MVC 4 Project dialog select the Web API template and click on the OK button.
    How to do it...

    The following project structure ...

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.