O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding and configuring an MVC service to the ASP.NET project

Since ASP.NET Core, the Web API, was merged with MVC, we need to add an MVC service to implement a Web API in our application:

  1. Install the NuGet package Microsoft.AspNetCore.MVC.
  2. Open the Startup.cs file from the root folder of the project in Visual Studio.
  3. Add the following statement under the ConfigureServices method to add the MVC service to our project
    public void   ConfigureServices(IServiceCollection       services)           {               services.AddMvc();           }   
  1. We just enabled MVC in our project. Next, we will wire up MVC with our request pipeline by adding the following statement in the Configure method:
    app.UseMvc();

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required