如何以编程方式从配置文件中检索 configSource 位置

Fix*_*xer 5 c# web-config

有谁知道我如何使用标准 API 获取 configSource 值?

<appSettings configSource="AppSettings.config" />
Run Code Online (Sandbox Code Playgroud)

或者我是否需要解析 XML 中的 web.config 来获取值?

Pra*_*ana 1

尝试

  ConfigurationManager.AppSettings["configSource"]
Run Code Online (Sandbox Code Playgroud)

您需要using System.Configuration;在代码中添加 : 命名空间