Configure Method in .Net Core

The Configure() method handles the HTTP request by configuring the request pipeline.
Several extension methods are used to configure the pipeline.

IApplicationBuilder: Configure the application request pipeline
Get more details on this:

IHostingEnvironment: Provide information about application hosting(“Development/Production”)
Get more details on this:

ILoggerFactory: Built-in providers that send logs to one or more destinations
Get more details on this:

Configuration.GetSection(“Logging”) access the appsettings values
go to appsetting > Logging

{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Trace",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

loggerFactory.AddConsole() add log output when we run our app from the command line
loggerFactory.AddDebug() add log output when we run in Visual Studio in Debug mode, go to Output window in Visual Studio.
we can access the log, here’s how:

env.IsDevelopment() is for managing the exception if happen in development or production environment
get more about working with multiple environment:

app.UseStaticFiles() is for serving the static files from /wwwroot like html, css, js
get more details:

Author:

Since March 2011, have 8+ years of professional experience on software development, currently working as Senior Software Engineer at s3 Innovate Pte Ltd.

Leave a Reply