In an ASP.NET project on .NET 6 the user secrets are only loaded when the environment used is
WebApplication.CreateBuilder initializes a new instance of the
WebApplicationBuilder class with preconfigured defaults. The initialized
WebApplicationBuilder (builder) provides default configuration and calls
AddUserSecrets when the
Sometimes you need to run the project locally using a different environment, like
Production, or anything different from
Development. By default, the user secrets are not loaded in this situation. What should you do to load them?