complez
complez

Reputation: 8332

Web Site Administration Tool: Unable to connect to SQL Server database

I'm using Visual Studio 2008, MS SQL server 2008 Express

SQL server: zeroonea\SQL2008EXPRESS

i'm create a webproject, made a dbtest.mdf in App_Data, made some tables, use aspnet_regsql to create membership tables in there, everything work fine.

my connection string in 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>

It still work when i run web application, the code can connect to sql server

but when i run Web Site Administration Tool, click on Security tab, i throw a error

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.

Any suggestion?

Upvotes: 3

Views: 8227

Answers (4)

Petras
Petras

Reputation: 4759

This answer and other research helped me get this working. I have summarized the steps in detail here http://www.yart.com.au/Resources/Programming/ASP-NET-Security-Doesnt-Work.aspx

Upvotes: 0

SqlRyan
SqlRyan

Reputation: 33914

By default, I don't think SQL Express allows remote connections. You have to turn them on in the Server Networking tool.

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

Also, as that blog mentions, SQL Express may be configured to only allow "Trusted" connections, and by providing a username and password in your connection string, you're connecting using SQL authentication.

Upvotes: 1

MartW
MartW

Reputation: 12538

Is this any use?

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

The fact it's SQLExpress may be adding an extra complication here.

Upvotes: 0

Jakob Gade
Jakob Gade

Reputation: 12419

Did you replace the db login and password with *** for the sample? If not, that's probably your problem.

Upvotes: 0

Related Questions