【发布时间】:2020-04-23 08:46:21
【问题描述】:
我正在尝试使用“Configuation.GetSection”获取信息 appSettings.json 文件。但不知何故我无法得到这个。
这里是代码
appSettings.Development.json:
{
"test": {
"a": "sdfs"
}
startup.cs
var test = Configuration.GetSection("test");
我需要运行什么来从 appsettings.json 文件中获取信息。
请帮忙。提前致谢
【问题讨论】:
-
这不是 .net core 3.1 的一部分。我可以看到文件正在根属性下加载
-
是的,我很确定。
-
更新了屏幕截图,我可以在其中看到这些文件中的 json 文件和数据。
-
这能回答你的问题吗? Configuration.GetSection always returns null
标签: .net asp.net-core configuration