Is it possible to use Web Api in an existing project of Asp.Net MVC 4? Actually we have started the building project using Empty MVC Application template and now want to use Web Apli functionality in the project. Is it possible or do i need to add some Web Api DLL’s in the project.
Share
Yes, it is possible. When you create a new ASp.NET MVC 4 application from the empty template you already have all the required assemblies referenced and even the API routes setup (
~/App_Start/WebApiConfig.cshtml).So all that’s left now is to right click on the
Controllersfolder in your Solution Explorer and choose Add -> Controller and pick the Empty API Controller template:and then run the application and navigate to
/api/valueswhich will hit theGetaction.