【问题标题】:Web Site Administration Tool: Unable to connect to SQL Server database网站管理工具:无法连接到 SQL Server 数据库
【发布时间】:2010-11-29 08:36:31
【问题描述】:

我使用的是 Visual Studio 2008,MS SQL server 2008 Express

SQL 服务器:zeroonea\SQL2008EXPRESS

我正在创建一个 webproject,在 App_Data 中创建了一个 dbtest.mdf,创建了一些表,使用 aspnet_regsql 在其中创建成员表,一切正常。

我在 web.config 中的连接字符串:

  <connectionStrings>
    <add name="dbtestConnectionString" connectionString="Data Source=zeroonea\SQL2008EXPRESS;Initial Catalog=dbtest;Persist Security Info=True;User ID=***;Password=***"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

当我运行 web 应用程序时它仍然有效,代码可以连接到 sql server

但是当我运行网站管理工具时,点击安全选项卡,我抛出一个错误

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.

有什么建议吗?

【问题讨论】:

  • 我发现了问题,我们应该将名称“dbtestConnectionString”更改为“LocalSqlServer”并且它可以工作

标签: asp.net membership


【解决方案1】:

默认情况下,我认为 SQL Express 不允许远程连接。您必须在服务器网络工具中打开它们。

http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/

此外,正如该博客所述,SQL Express 可能配置为仅允许“受信任”连接,并且通过在连接字符串中提供用户名和密码,您正在使用 SQL 身份验证进行连接。

【讨论】:

    【解决方案2】:

    您是否将示例的数据库登录名和密码替换为 ***?如果没有,那可能是你的问题。

    【讨论】:

    • 如果我侮辱了你,我很抱歉,我不是故意的。但根据您在问题中提供的信息,这是我的最佳答案。
    【解决方案3】:

    这有用吗?

    http://weblogs.asp.net/lhunt/archive/2005/09/26/425966.aspx

    它是 SQLExpress 的事实可能在这里增加了额外的复杂性。

    【讨论】:

      【解决方案4】:

      这个答案和其他研究帮助我完成了这项工作。我这里已经详细总结了步骤http://www.yart.com.au/Resources/Programming/ASP-NET-Security-Doesnt-Work.aspx

      【讨论】:

        猜你喜欢
        • 2011-03-17
        • 1970-01-01
        • 1970-01-01
        • 2013-06-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-09-30
        相关资源
        最近更新 更多