-->

连接名称“DefaultConnection”在应用程序的配置没有被发现或连接字符串为空(The c

2019-10-17 23:50发布

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

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

实际的错误,我在死亡的黄色画面得到的是下面给出:

配置错误

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

分析器错误消息:连接名称“DefaultConnection”中的应用程序的配置没有被发现或连接字符串是空的。

源错误:

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如初。

Answer 1:

添加到您的web.config文件

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


Answer 2:

我唯一能想到的事情是,你可以浏览没有适当的成员连接字符串的公共页面。 然而,只要需要验证您的浏览器页面,它就会失败。

如果你有工作连接字符串替换DefaultConnection它应该工作。



文章来源: The connection name 'DefaultConnection' was not found in the applications configuration or the connection string is empty