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 :-
CodePudding user response:
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:
- Go to your
solution
andright click on it
Select Property
- Choose
Multiple Startup
Project