Sql-server – ASP.NET Website Administration Tool: Unable to connect to SQL Server database

asp.netasp.net-mvcSecuritysql server

I am trying to get authentication and authorization working with my ASP MVC project. I've run the aspnet_regsql.exe tool without any problem and see the aspnetdb database on my server (using the Management Studio tool).

my connection string in my web.config is:

 <connectionStrings>
 <add name="ApplicationServices"
     connectionString="data source=MYSERVERNAME;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />
 </connectionStrings> 

The error I get is:

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.

In the past, I have had trouble connecting to my database because I've needed to add users. Do I have to do something similar here?

Edit
Changing the connection string ultimately solved the problem.
For the records I am using VS2010, ASP MVC2, SServer 2008

<connectionStrings>
<add name="ApplicationServices"
     connectionString="data source=MYSERVERNAME;Integrated Security=True;Initial Catalog=aspnetdb"
     providerName="System.Data.SqlClient" />
</connectionStrings>

Best Answer

You are using a server name, "MYSERVER" as if this is a full SQl Server Default instance, not Sql Express. I don't think you can use the AttachDbFilename with a full blown sql server. Either add "\SQLEXPRESS" (instance name) to your server name or get rid of the AttachDbFileName and use Database="NAMEOFDATABASE"