Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple WEB API REST Project

Tags:

What is the best way to create a simple REST API in Visual Studio 2013 using ASP.NET MVC.

I just want something with controllers and route config along with any other basic requirements for a HTTP REST API.

I don't require any Razor view engine, Javascript or HTML inclusions.

How can I create a project without all the unwanted extras, which I usually remove in the past?

Thank you.

like image 261
jim Avatar asked Oct 25 '14 13:10

jim


People also ask

How do I create a Web API project in Visual Studio?

For this, open Visual Studio and click on File menu and click on New Project. This will open New Project popup as below. In the New Project popup, expand Visual C# and select Web node in the left pane. Select ASP.NET Web Application template in the middle pane and enter the name of a project and click OK.

How do I create a REST API project in Visual Studio?

Select the Visual C# | Web project type from the project type tree view, then select the ASP.NET MVC 4 Web Application project type. Set the project's Name to ContactManager and the Solution name to Begin, then click OK. In the ASP.NET MVC 4 project type dialog, select the Web API project type. Click OK.


1 Answers

It's all in the template you select.

  1. In the New Project dialog, select ".NET Framework 4.5" if not already selected
  2. Navigate to Installed > Templates > Visual C# > Web, then "ASP.NET Web Application" and select OK.
  3. On the dialog to select the project type, select "Empty", but then be sure to check "Web API" under "Add folders and core references.

Now you'll have the bare minimums created.

See: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

like image 96
Jason W Avatar answered Oct 06 '22 12:10

Jason W