网站管理工具:无法连接到SQL Server数据库

时间:2009-09-18 01:46:47

标签: asp.net membership

我正在使用Visual Studio 2008,MS SQL Server 2008 Express

SQL server: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.

有什么建议吗?

4 个答案:

答案 0 :(得分:1)

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

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

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

答案 1 :(得分:0)

您为样本替换了db登录名和密码吗?如果没有,那可能是你的问题。

答案 2 :(得分:0)

这有用吗?

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

事实上它是SQLExpress可能会在这里增加一个额外的复杂功能。

答案 3 :(得分:0)

这个答案和其他研究帮助我实现了这个目标。我在这里详细总结了这些步骤http://www.yart.com.au/Resources/Programming/ASP-NET-Security-Doesnt-Work.aspx