I created a solution a while ago that contains a Web API 2 project (provides JSON data to mobile devices) and a Class Library (includes my data access services).
The Web API project uses Ninject for DI and everything works fine.
Now I need to add a separate MVC project for a few web pages. The api should be accessible from www.example.com/api/controller
, while the website should be accessed through www.example.com/controller
.
The problem is that each of these two, has a different "Register" method with seemingly incompatible route collections. If I set the MVC project as the startup project, routes for the api are not registered, and vice versa. If I set "Mutiple startup projects", they run on different ports which is not my cup of tea.
How I can set the MVC project as the startup project, while registering all routes for both of them?
One more thing. Because the Web API project was created sooner, Ninject configuration has been written inside it. Of course, some of the services from the Class Library project are needed inside the new MVC project. Do I have to move Ninject configuration to the MVC project, or they just work because they are run on startup of the Web API Project?