CreateDefaultBuilder method have done what?

When we created a new ASP.NET Core Web application, the system uses CreateDefaultBuilder method, which completed the following actions:

  • use Kestrel as the web server and configure it using the application's configuration providers
  • set the ContentRootPath to the result of GetCurrentDirectory()
  • load IConfiguration from 'appsettings.json' and 'appsettings.[EnvironmentName].json'
  • load IConfiguration from User Secrets when EnvironmentName is 'Development' using the entry assembly,
  • load IConfiguration from environment variables
  • configure the ILoggerFactory to log to the console and debug output
  • and enable IIS integration

If the parameters are CreateDefaultBuilder version, it will also be initialized IConfiguration by command line parameters.

The above content from official documents: microsoft.aspnetcore.webhost.createdefaultbuilder

Guess you like

Origin www.cnblogs.com/youring2/p/11444067.html