Demystifying the Startup.cs file
The Startup.cs
file, located in the web project's root folder, is first executed when the application starts. The code inside the file is as follows:
namespace Web { public class Startup { public Startup(IConfiguration configuration)… public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services)… public void Configure(IApplicationBuilder app, IWebHostEnvironment env)… } }
So let's check this out one by one.
The first block of code you will see is the Startup
constructor, which takes an IConfiguration
interface and assigns it to the public IConfiguration
Configuration
getter. The Configuration...