Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseDefaultHostingConfiguration has been removed #174

Open
BrennanConroy opened this issue Apr 29, 2016 · 0 comments
Open

UseDefaultHostingConfiguration has been removed #174

BrennanConroy opened this issue Apr 29, 2016 · 0 comments

Comments

@BrennanConroy
Copy link
Member

BrennanConroy commented Apr 29, 2016

.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.ComandLine
  • Microsoft.Extensions.Configuration.EnvironmentVariables
  • Microsoft.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

@BrennanConroy BrennanConroy added this to the 1.0.0-rc2 milestone Apr 29, 2016
@aspnet aspnet locked and limited conversation to collaborators Apr 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant