My .NET Core 6 app service has the following setup inside Program.cs
:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
//builder.Services.AddSingleton... ETC...
var app = builder.Build();
According to docs, it has a default precedence in case of different sources:
- Command-line arguments
- Non-prefixed environment variables
- User secrets
- appsettings.{Environment}.jsonappsettings.Production.json and appsettings.Development.json.
- appsettings.json
But I don't see if they mention where AppService
settings from the Azure portal configuration get applied.
I expect that Azure portal settings for "MyKey1" would override any of the previous, but it is not happening.
Let's say, I have a appsettings.json with:
{ MyKey1 : "Value1" }
and, in Azure site config:
MyKey1................Value2
When I deploy the app to the cloud it takes Value1 instead of Value2, for MyKey1.
Is this the normal behavior? What could I be doing wrong?
CodePudding user response:
App Settings get injected as Environment Variables. So I would assume they fall into position 2 of your list.