1

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?

kevin
  • 338
  • 2
  • 13
  • If you run `dotnet user-secrets list` in the project folder of the asp.net app what did you get? Can you find your settings. Could you include a sample of the secrets.json and of the code that access configuration? – Roberto Ferraris Feb 17 '23 at 12:57
  • The UserSecrets configuration source is not being added. I have to manually add the AddUserSecrets method myself which conflicts with the Microsoft Documentation. – kevin Feb 17 '23 at 13:38
  • `dotnet user-secrets init` will create new secrets.json for the project and update `UserSecretsId` in .csproj file. If you did not initialize usec-secrets store or did not specify `UserSecretsId` then ASP.NET Core will not load the secret file. – Adilet Soronov Mar 20 '23 at 09:11

0 Answers0