Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.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
ASP.NET MVC 2:连接字符串错误?_Asp.net_Asp.net Mvc 2_Web Config_Connection String - Fatal编程技术网

ASP.NET MVC 2:连接字符串错误?

ASP.NET MVC 2:连接字符串错误?,asp.net,asp.net-mvc-2,web-config,connection-string,Asp.net,Asp.net Mvc 2,Web Config,Connection String,我需要重新开始一个新的MVC2项目 这就是错误所指向的: public DealDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["RESTRO_DEVConnectionString"].ConnectionString, mappingSource) { OnCreat

我需要重新开始一个新的MVC2项目

这就是错误所指向的:

public DealDataContext() : 
                    base(global::System.Configuration.ConfigurationManager.ConnectionStrings["RESTRO_DEVConnectionString"].ConnectionString, mappingSource)
            {
                OnCreated();
            }
这两个项目之间的唯一区别可能是第一个项目不是一个空的MVC2项目。。。而第二个是


是否存在一些不同的定义或设置?

这是在web.config文件中查找连接字符串。该web.config文件中的连接字符串名为“RESTRO_DEVConnectionString”


如果您的新web.config文件中没有此项,您可能可以从原始web.config文件中复制XML行。

使用多项目解决方案,连接字符串引用是否需要位于每个project web.config文件中?作为web应用程序的解决方案项目具有应包含其连接字符串的web.config文件。其他解决方案项目可以有app.config文件,但应该依赖应用程序的web.config来告诉他们要使用哪个数据库。