How it works

The Startup.cs file contains the Startup class. ASP.NET Core requires a Startup class and will look for this class by default. By convention the Startup class is called Startup, but you can call it something else if you want. If you need to rename it, then you also need to ensure that the Program.cs file is modified so that the WebHostBuilder() specifies the correct class name for .UseStartup:

public static void Main(string[] args){   var host = new WebHostBuilder()       .UseKestrel()       .UseContentRoot(Directory.GetCurrentDirectory())       .UseIISIntegration()       .UseStartup<Startup>()       .Build();   host.Run();}

Going back to our Startup class in the Startup.cs file, when you look inside this class you will see two methods. The methods are Configure() ...

Get C# 7 and .NET Core Cookbook 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.