连接名称“DefaultConnection”在应用程序的配置没有被发现或者连接字符串为空 [英] The connection name 'DefaultConnection' was not found in the applications configuration or the connection string is empty

查看:2919
本文介绍了连接名称“DefaultConnection”在应用程序的配置没有被发现或者连接字符串为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始的时候我在Visual Studio 2010专业版在内部开发服务器调试模式运行我的ASP.NET MVC应用程序4收到这个消息。这是工作的罚款,直到昨天。它刚开始来了昨天。

I just started getting this message when I run my ASP.NET MVC 4 application in debug mode in Visual Studio 2010 Professional in the internal development server. It was working fine till yesterday. It just started coming yesterday.

此外,该错误来,只有我的桌面上。该应用程序可以运行在所有其他开发人员的机器,我的笔记本电脑,以及所有服务器,无论是在调试模式精细以及当在IIS上部署。

Also, this error comes only on my desktop. The application runs fine on all the other developer's machines, my laptop, and all the servers, both in debug mode as well as when deployed on IIS.

实际的错误,我在死亡的黄色画面得到如下所示:

The actual error I get in the yellow screen of death is given below:

配置错误

描述:的此请求提供服务所需的配置文件的处理过程中发生错误。请检查下面的特定错误详细信息并适当地修改配置文件。

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

分析器错误信息:的连接名称DefaultConnection在应用程序的配置没有被发现或者连接字符串为空

Parser Error Message: The connection name 'DefaultConnection' was not found in the applications configuration or the connection string is empty.

源错误:

Line 267:    <membership defaultProvider="DefaultMembershipProvider">
Line 268:      <providers>
Line 269:        <add name="DefaultMembershipProvider" 
                      type="System.Web.Providers.DefaultMembershipProvider,
                            System.Web.Providers, Version=1.0.0.0, Culture=neutral,
                            PublicKeyToken=31bf3856ad364e35" 
                      connectionStringName="DefaultConnection" 
                      enablePasswordRetrieval="false" enablePasswordReset="true"
                      requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
                      maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
                      minRequiredNonalphanumericCharacters="0" 
                      passwordAttemptWindow="10" applicationName="/" />
Line 270:      </providers>
Line 271:    </membership>

我检查了我的TFS的web.config的版本历史并没有而且也的从来没有使用是的该名称的连接字符串 DefaultConnection 如初。

I checked the version history of my web.config in TFS and there isn't and there also never used to be a connection string by that name DefaultConnection ever.

推荐答案

添加到您的web.config文件

Add this to your web.config file

<connectionStrings><add name="DefaultConnection" connectionString="Data Source=YourServername;Initial Catalog=YourDBname;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /></connectionStrings>

这篇关于连接名称“DefaultConnection”在应用程序的配置没有被发现或者连接字符串为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆