【发布时间】:2017-04-07 03:09:03
【问题描述】:
我如何从 app.config 和 web.config 中读取数据。
app.config 读取如下。如何从 web.config 读取
using System.Configuration;
string configvalue1 = ConfigurationManager.AppSettings["countoffiles"];
string configvalue2 = ConfigurationManager.AppSettings["logfilelocation"];
还有我们为什么要存储在这些配置文件中?
我如何从 app.config 下面的用户定义标签
<display>读取??
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<display>
<add key="countoffiles" value="7" />
<add key="logfilelocation" value="abc.txt" />
</display>
</configuration>
app.config 和 web.config 中存储的值有什么区别? 我如何决定将某些数据保存在哪里?
当我在 MVC 应用程序的 web.config 中添加
<display>标签时出现此错误。有任何线索说明原因吗??
【问题讨论】:
标签: asp.net-mvc web-config app-config