- Notifications
You must be signed in to change notification settings - Fork 81
Open
Milestone
Description
.UseDefaultHostingConfiguration(args) has been removed.
To have equivalent behavior from before you can add:
var config = new ConfigurationBuilder() .AddJsonFile("hosting.json", optional: true) .AddEnvironmentVariables(prefix: "ASPNETCORE_") .AddCommandLine(args) .Build(); var host = new WebHostBuilder() .XYZ() .UseConfiguration(config) .ZYX() .Build(); And also ensure the application's project.json file has references to these NuGet packages:
Microsoft.Extensions.Configuration.ComandLineMicrosoft.Extensions.Configuration.EnvironmentVariablesMicrosoft.Extensions.Configuration.Json
In addition ASPNETCORE_ENVIRONMENT is included as a fallback if you don't add a setting for "environment" yourself.
Most apps don't need all these settings though.
Issues causing the removal of UseDefaultHostingConfiguration are aspnet/Hosting#700 and aspnet/Hosting#727
Please use aspnet/Hosting#737 for discussion