1

当我在内部开发服务器的 Visual Studio 2010 Professional 中以调试模式运行我的 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

4

2 回答 2

3

将此添加到您的 web.config 文件中

<connectionStrings><add name="DefaultConnection" connectionString="Data Source=YourServername;Initial Catalog=YourDBname;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /></connectionStrings>
于 2013-04-10T13:49:29.110 回答
0

我能想到的唯一一件事是您可以在没有适当的会员连接字符串的情况下浏览公共页面。但是,一旦您浏览需要身份验证的页面,它就会失败。

如果将DefaultConnection替换为工作连接字符串,它应该可以工作。

于 2013-04-10T20:33:16.927 回答