Add Web API to an existing ASP.Net web application project
Posted by on December 04, 2013 11:07
-
Add below listed references
- System.Net.Http.dll
- System.Web.Http.dll
- System.Web.Http.WebHost.dll
-
Import namespace System.Web.Http and System.Web.Routing in Globals.asax.cs
-
Call RouteTable.Routes.MapHttpRoute
RouteTable.Routes.MapHttpRoute("API Default", "api/{controller}/{action}", new[] { "App.Namespace" });
-
Add a controller code file deriving from System.Web.Http.ApiController