Adding WebAPI to your current MVC Project

Started off as regular web site in MVC, later you want to add Web API to the same project?  You can simply add Web API controllers, but to make it work you have to do few more steps.

inside your Global.asax, you have to make reference to System.Web.Http and also add  GlobalConfiguration.Configure(WebApiConfig.Register)

This should take care of API request routing properly and good to go.

Iko puts it all well at http://stackoverflow.com/questions/26067296/how-to-add-web-api-to-an-existing-asp-net-mvc-5-web-application-project

Leave a Reply