Enabling MVC and controller

Enable MVC in your MVC web application project, as done in the authorization server project and add Home controller. Here is the code of HomeController:

    [Authorize]       public IActionResult Index()       {            return View();       }

Configure MVC web application on port 5002.

You can configure the MVC web application on port 5002 by updating the launchsettings.json file and adding the UseUri in the WebHostBuilder object in the Program class.

Update the port to 5002 in the following entry:

    "WebApp": {       "commandName": "Project",       "launchBrowser": true,       "launchUrl": "http://localhost:5002",       "environmentVariables": {         "ASPNETCORE_ENVIRONMENT": "Development"       }     }

Here is the code of the Program class:

 public static void Main(string[] ...

Get Enterprise Application Architecture with .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.