Search code examples
c#asp.net-coreappsettings

Key-per-file config in .NET Core


I am trying to get this to work:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0#key-per-file-configuration-provider

But I am not having any success when it comes to using hierarchical file names. I want to map some value to Logging:Backend:URL, but I can only get it to work on top-level settings, when I'm not using any :.

My directory contains this file:

Logging_Backend_URL

Thanks in advance


Solution

  • Judging by the docs the filenames should have 2 underscores and you only have one:

    The double-underscore (__) is used as a configuration key delimiter in file names. For example, the file name Logging__LogLevel__System produces the configuration key Logging:LogLevel:System.