WebHost.CreateDefaultBuilder Method

Definition

Overloads

CreateDefaultBuilder()

Initializes a new instance of the WebHostBuilder class with pre-configured defaults.

CreateDefaultBuilder(String[])

Initializes a new instance of the WebHostBuilder class with pre-configured defaults.

CreateDefaultBuilder()

Initializes a new instance of the WebHostBuilder class with pre-configured defaults.

public static Microsoft.AspNetCore.Hosting.IWebHostBuilder CreateDefaultBuilder ();
Returns

The initialized IWebHostBuilder.

Remarks

The following defaults are applied to the returned WebHostBuilder: use Kestrel as the web server, 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, configures the ILoggerFactory to log to the console and debug output, enables IIS integration, enables the ability for frameworks to bind their options to their default configuration sections, and adds the developer exception page when EnvironmentName is 'Development'

CreateDefaultBuilder(String[])

Initializes a new instance of the WebHostBuilder class with pre-configured defaults.

public static Microsoft.AspNetCore.Hosting.IWebHostBuilder CreateDefaultBuilder (string[] args);
Parameters
args
String[]

The command line args.

Returns

The initialized IWebHostBuilder.

Remarks

The following defaults are applied to the returned WebHostBuilder: use Kestrel as the web server, 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, load IConfiguration from supplied command line args, configures the ILoggerFactory to log to the console and debug output, enables IIS integration, enables the ability for frameworks to bind their options to their default configuration sections, and adds the developer exception page when EnvironmentName is 'Development'