Skip to content

ConfigureAppConfiguration not taken into account. #2903

@whizkidwwe1217

Description

@whizkidwwe1217

I tried to put kestrel urls into a separate json file so I don't have to recompile the project every time I change urls but the problem is that the ConfigureAppConfiguration doesn't work. I don't want to use the UseConfigurationMethod because I can't find a way to get the IHostingEnvironment to set up different settings for different environment. Putting these configurations in the Startup class doesn't seem to work either.

hosting.json
image

Doing it this way works:
image
dotnet run:

Now listening on: http://[::]:4000
Now listening on: http://[::]:5000
Now listening on: http://[::]:5001
Now listening on: http://[::]:5002
Now listening on: http://[::]:5003

But doing this will not:
image
dotnet run:

Now listening on: http://localhost:5000

If I do the first method, how do I get the Hosting Environment?
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions