Custom JsonConfigurationProvider - ASP.NET Core uses wrong implementation
As of .NET Core 2.0, appsettings.{env.EnvironmentName}.json
is loaded automatically for you. If you have encrypted it, then the framework will probably have an issue parsing it.
.ConfigureAppConfiguration((hostingContext, config) =>
{
...
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
...
MetaPackages/src/Microsoft.AspNetCore/WebHost.cs
I would try to name your file something else.
An alternative solution that my team recently implemented was to move secrets to app.config and use protected configuration to encrypt it. A custom configuration provider reads the application settings (e.g. Azure:ApiKey
) and supplies them to the Core framework.