Removing inherited ASP.NET Core appsettings

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 05:44:35

According to Configuration in ASP.NET Core documentation, settings are loaded from both files and if a setting is specified in both on them, than the one in the latter, i.e. appsettings.{env.EnvironmentName}.json in your setup, will override the first one.

So, if a setting is specified in the appsettings.json file and you want to remove it when running in the Development environment, you will need to explicitly set that accordingly (null, {}, etc. depending on the setting) in the appsettings.Development.json file.

However, such setup may suggest your setting should not lie in the generic appsettings.json file, but in the specific environments configuration settings file directly. This way, it might be easier to write your settings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!