Skip to content

Need the ability to suppress the environment variable config source #20328

Closed
@Tratcher

Description

@Tratcher

#20308

Describe the bug

Blazor's debug proxy runs as a separate process launched from the web app. When running behind IIS out-of-proc it inherits all of the environment variables from IIS/ANCM which causes it to think it is the one responsible for handling requests proxied from IIS. It also ends up with the wrong content root and other such config. Removing ConfigureWebHostDefaults or UseIISIntegration doesn't help because IIS sets the HOSTINGSTARTUPASSEMBLIES environment variable to inject itself (maybe that was a bad idea...).

The debug proxy app needs full control over its configuration and thus needs a way to suppress any config coming from environment variables. That's not possible today because the env var config provider is added by default.

_config = new ConfigurationBuilder()
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
_builder.ConfigureHostConfiguration(config =>
{
config.AddConfiguration(_config);

Proposal

Add a way that allows the caller of ConfiureWebHost and/or ConfigureWebHostDefaults to opt out of the environment variable config source.

Metadata

Metadata

Assignees

Labels

Needs: DesignThis issue requires design work before implementating.area-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions