0

We have an existing ASP.NET MVC 5 project. We want to use WebAPI too.

Is it a good idea to install WebAPI into the MVC project using Nuget? Or would it be better to create a new project in the same VS Solution specifically for WebAPI? If the latter, how would the routing be done?

I gather having MVC and WebAPI in the same project can cause issues with Dependency Injection. Is this true?

Anthony
  • 692
  • 3
  • 9
  • 23

1 Answers1

0

You can put the together in the same project, install the nuget package and then add the startup classes (you can see how to do that in the template).

I can't speak to dependency resolver issues though.

However I would ask myself first why would you want MVC + Web API, in many cases you can just use MVC to do that job, and thus you stay with one framework.

I'd really consider Web API if you want to use content negotiation, OData or if you have a lot of ready made Web API code you want to port.

Yishai Galatzer
  • 8,791
  • 2
  • 32
  • 41