【发布时间】:2011-09-30 03:04:47
【问题描述】:
我有一个使用 web.debug.config 文件转换的 web.config 文件。尝试通过 System.Configuration.ConfigurationManager.AppSettings 访问这些值没有任何结果。
我的 web.config appSettings 为空。
<configuration>
<appSettings>
</appSettings>
</configuration>
应用了我的 web.debug.config 转换。这是一个示例。
<configuration>
<appSettings>
<add key="CommonURL" value="localhost/mysite/" xdt:Transform="Insert" />
</appSettings>
</configuration>
这是尝试获取此值的代码,它返回 null。
var cu = System.Configuration.ConfigurationManager.AppSettings["CommonURL"];
知道为什么会这样吗?
【问题讨论】:
标签: c# visual-studio-2010