I have the following in Startup (asp.net core 2.2 proj):
public Startup(IConfiguration configuration, IHostingEnvironment environment)
{
Configuration = configuration;
Environment = environment;
new ConfigurationBuilder()
.SetBasePath(Environment.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true)
.AddEnvironmentVariables()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
var appSettings = new AppSettings();
Configuration.Bind("appSettings", appSettings);
services.AddSingleton(appSettings);
....
}
I've set values to override all my app setting values in appsettings.json, but my app service is still using what is in appsettings instead of what I put in the portal. Per the documentation, those portal app settings for the app service should override the appsettings.json file and get used instead. Am I missing a step?
Thanks
Edit:
Even changing Startup to the following doesn't pick up my azure app settings:
public Startup(IConfiguration configuration, IHostingEnvironment environment)
{
Configuration = configuration;
Environment = environment;
Configuration = new ConfigurationBuilder()
.AddConfiguration(configuration)
.SetBasePath(Environment.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true)
.AddEnvironmentVariables()
.Build();
}
ConfigurationBuilder
. – Leotie