Reputation: 1
We want to build an asp.net core web application. it contains MVC part for returning Views and API to return JSON and have Restful services for our web application.
So can I have MVC and Web API inside the same project? as currently when i want to create a new project inside .NET 6.0 i have to select the either MVC or Web API type :-
Upvotes: 4
Views: 3741
Reputation: 22515
So can I have MVC and Web API inside the same project? as currently when i want to create a new project inside .NET 6.0 i have to select the either MVC or Web API type :-
Certainly you can. What all you need is, you should have one solution
. Furthermore, within the solution, you ought to create two project. One for MVC application
and another for Web API
application. Here is the simulation how you can achieve that:
Project Architecture Would be Like:
If you want to run two project together:
solution
and right click on it
Select Property
Multiple Startup
ProjectUpvotes: 4