Read appsettings.json - Fields remain null
services.Configure<Config>(Configuration);
This line doesn't achieve the desired result because the JSON properties you're looking for are nested under a Config
property in your appsettings.json
file. To load these values as intended, use GetSection
to grab the Config
section and pass that into the Configure<TOptions>
method:
services.Configure<Config>(Configuration.GetSection("Config"));