I have an asp.net core application which has settings for the Identity Server. For that I have have a appsettings.json, an appsettings.Development.json and an appsettings.Production.json.
appsettings.json:
..
"ApplicationInsights": {
"InstrumentationKey": ""
},
"IdentityServer": {
"Clients": {
"ApplySupportTool.Client": {
"Profile": "IdentityServerSPA"
}
}
},
"BuildInfo": {
"Environment": "Integration",
"Version": "1.0.0 Beta"
},
..
appsettings.Development.json
{
"IdentityServer": {
"Key": {
"Type": "Development"
}
}
}
appsettings.Production.json
{
"IdentityServer": {
"Key": {
"Type": "Store",
"StoreName": "My",
"StoreLocation": "CurrentUser",
"Name": "[Name]"
}
}
}
Locally that works without a problem, and I can switch between them with removing the environment variable from the launchsettings:
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
In Terms of loading the settings files analog to the default template my HostBuilder is created like this with no special additions for the settings files.
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureWebHostDefaults(webHostBuilder =>
{
webHostBuilder
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseAzureAppServices();
})
.UseSerilog();
}
When I check in the constructor of the Startup.cs I can verify that it loaded the additional file as well.
But when I deploy that to Azure it seems that always the development version is loaded. As far as I know with no value set it should go for production (which works local). To be sure I also tried to add a ASPNETCORE_ENVIRONMENT with the value "Production" to my AppService explicitly. But that didn't change anything too. Do I have to load that in a special way or something?