在应用程序配置中找不到LocalSqlServer或连接字符串为空

我刚刚将.NET 3.5 MVC 1项目升级到.NET 4.0 MVC 3,出于某种原因,现在当我尝试运行它时,它说:

The connection name ‘LocalsqlServer’ was not found in the applications
configuration or the connection string is empty.`

我不知道为什么它这样做,因为没有在我的代码中它找到一个LocalsqlServer连接字符串,如果我在我的配置文件中输入一个LocalsqlServer连接字符串与我的标准连接字符串的值,并尝试进入该网站,它带我到’请登录’的URL,但有一个404页面(而不是自定义404页面)

谁知道问题可能是什么?

问候,
掠夺

解决方法

LocalsqlServer连接字符串在Machine.config中定义.

如果您没有认的Machine.config文件,则可能已将其删除.然后,您需要在自己的Web.config中重新添加它.

我的LocalsqlServer:

<add name="LocalsqlServer" connectionString="data source=.\sqlEXPRESS;Integrated Security=sspI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.sqlClient"/>

你可以在这里找到你的machine.config

C:\Windows\Microsoft.NET\Framework\[FRAMEWORK VERSION]\CONfig\machine.config

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....