5

I have created a new asp.net (standard) web api project and now I would like to have the front logic (ASP.net MVC) in the same project, I came to know that we can have both client (MVC) and server (Web API) application in the same project. I tried to find the step by step process to follow, but I couldn't find any. I would really appreciate if someone can provide me steps to follow, as this is the first time I'm building a application from scratch. Thanks in advance.

Felipe Oriani
38.7k20 gold badges141 silver badges203 bronze badges
asked Apr 29, 2019 at 16:35
1
  • What version of .Net? What version of web api? Commented Apr 29, 2019 at 17:21

1 Answer 1

5

You could try to create an empty asp.net project and define that this project has the web and api features. For sample:

  1. in Visual Studio 2019, select the asp.net template:

enter image description here

  1. Define the name of the project

enter image description here

  1. Select the Empty and check the options, MVC and Web Api

enter image description here

In the App_Start folder you will see two files. The RouteConfig.cs file define the routes for the ASP.NET MVC Web App. The WebApiConfig.cs file define the routes for the ASP.NET Web Api application.

Importante: The API controllers has a prefix on the route called api, so, when you create a controller that inherits from ApiController, it will be routed by api/ControllerName.

answered Apr 29, 2019 at 17:43

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.