Skip to content

UseEnvironment does not work when using generic host based webhost #18499

@davidfowl

Description

@davidfowl

Seems like we override the configuration keys as the last entry in the host configuration when ConfigureWebHostDefaults is called. This might affect other host setting as well.

public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseEnvironment("Staging")
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                    // webBuilder.UseEnvironment("Staging"); // This works
                });

cc @Tratcher

Metadata

Metadata

Assignees

Labels

✔️ Resolution: Won't FixResolved because we decided not to change the behavior reported in this issue.Status: Resolvedarea-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions