C# 网络配置管理器
我正在研究C#2010。由于以下错误,我的网站无法运行: 当前数据库中不存在名称“WebConfigionManager” 上下文 虽然我已经包括了使用System.Web.Configuration的C# 网络配置管理器,c#,asp.net,configuration,C#,Asp.net,Configuration,我正在研究C#2010。由于以下错误,我的网站无法运行: 当前数据库中不存在名称“WebConfigionManager” 上下文 虽然我已经包括了使用System.Web.Configuration的,错误指向的代码行是: String connectionString = WebConfigrationManager.ConnectionStrings["costr"].ConnectionString; 添加System.ConfigurationReference,然后添加using
代码>,错误指向的代码行是:
String connectionString = WebConfigrationManager.ConnectionStrings["costr"].ConnectionString;
添加System.Configuration
Reference,然后添加using System.Configuration添加System.Configuration
Reference,然后添加using System.ConfigurationUse
string cnStr=System.Configuration.ConfigurationManager.ConnectionStrings["costr"].ConnectionString;
或
使用
或
您应该有一个对System.Web的引用您应该有一个对System.Web的引用这已经存在于System.Web.dll中,只需添加名称空间即可
使用System.Web.Configuration这已经存在于System.Web.dll中,只需添加名称空间即可
使用System.Web.Configuration我相信该类驻留在System.Web中。至少在.NET2.0中是这样
添加对该类的引用,然后重试。我相信该类驻留在System.Web中。至少在.NET2.0中是这样
添加对该文件的引用,然后重试。是否只有我注意到您拼错了WebConfiguration Manager
WebConfigrationManager
这可能是罪魁祸首之一。我是唯一注意到你拼错WebConfiguration Manager的人吗
WebConfigrationManager
这可能是罪魁祸首。只需添加名称空间:
using System.Web.Configuration;
只需添加名称空间:
using System.Web.Configuration;
您将using
指令包含在何处?您是否清理并重新生成了解决方案?是的,我有。。我添加了System.Configuration作为参考,并解决了问题,但它开始出现异常错误…您在哪里包含了使用
指令的?您是否清理并重建了解决方案?是的,我。。我添加了System.Configuration作为参考,它解决了问题,但它开始出现异常错误。。。