My understanding from the Microsoft documentation is the userSecret configuration is supposed to be automatically created by the WebApplication.CreateBuilder() while in the development environment. This is not true for my current WebAPI .net7 application. I have run the init command and populated the secrets file. Any ideas on why the userSecrets would be missing from the configuration sources?
From the documentation:
The initialized
WebApplicationBuilder
(builder
) provides default configuration and callsAddUserSecrets
when theEnvironmentName
is Development.
Ensure that your environment is set to Development
. This is usually done via the ASPNETCORE_ENVIRONMENT
env variable for web apps.