Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 网络配置管理器_C#_Asp.net_Configuration - Fatal编程技术网

C# 网络配置管理器

C# 网络配置管理器,c#,asp.net,configuration,C#,Asp.net,Configuration,我正在研究C#2010。由于以下错误,我的网站无法运行: 当前数据库中不存在名称“WebConfigionManager” 上下文 虽然我已经包括了使用System.Web.Configuration的,错误指向的代码行是: String connectionString = WebConfigrationManager.ConnectionStrings["costr"].ConnectionString; 添加System.ConfigurationReference,然后添加using

我正在研究C#2010。由于以下错误,我的网站无法运行:

当前数据库中不存在名称“WebConfigionManager” 上下文

虽然我已经包括了使用System.Web.Configuration的
,错误指向的代码行是:

String connectionString = WebConfigrationManager.ConnectionStrings["costr"].ConnectionString;

添加
System.Configuration
Reference,然后添加
using System.Configuration

添加
System.Configuration
Reference,然后添加
using System.Configuration

Use

 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作为参考,它解决了问题,但它开始出现异常错误。。。