Skip to content

ASPNETCORE_ENVIRONMENT and HTTPS? #19359

Closed
@plettb

Description

@plettb

I'm really not sure if this is an issue or a question. I've run into some strange behavior and would like to understand it better and, if possible, get it working the way I'd like/expect.

In our application we have a number of projects that require different settings when running on Docker. We've been handling this by using a "SlowCheetah - like" process to transform our "appsettings.json" file. I wish I knew the right name for this feature, but essentially we have "appsettings.json", "appsettings.Development.json", and "appsettings.Docker.json" files. Changing the "ASPNETCORE_ENVIRONMENT" variable in the "docker-compose.override.yml" works beautifully for this. So far, all's well.

HOWEVER, when I change the environment variable, HTTPS stops working! There is some kind of magic that VS and/or Docker are doing when the environment variable is set to "Development" that I don't understand. With "Development" I see the certs created upon first run, and used correctly. When I change the environment variable, the certs still get created, but they don't get used - Kestrel refuses to start: "Message=Unable to configure HTTPS endpoint. No server certificate was specified...". There are numerous articles on the Internet on how to fix this specific problem, but I've had no luck making any of them work unless my environment is set back to "Development". Among other things, I've tried a variety of settings for "ASPNETCORE_Kestrel__Certificates__Default__Password" and "ASPNETCORE_Kestrel__Certificates__Default__Path" with no success.

Obviously, I'd like to use BOTH the environment variable and HTTPS. Any help would be much appreciated.

Thanks!
Brad.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions