I have a database in SQLExpress 2008 that I am accessing via an EF4 connection. It also contains the ASP.Net role provider tables for the website. In the web.config there are two separate connection strings pointing to the same database. When it comes to debugging the database I get the following error:
Unable to open the physical file "D:\TFS\Main\Source\TestWeb\TestWeb\App_Data\TestDB.mdf". Operating system error 32: "32(failed to retrieve text for this error. Reason: 15105)". An attempt to attach an auto-named database for file D:\TFS\Main\Source\TestWeb\TestWeb\App_Data\TestDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
What I assume this means is that the two different connection strings cannot both attach to the SQLExpress database at the same time?
Here are the connection strings:
<add name="SqlRoleManagerConnection"
connectionString="data source=.\SQLEXPRESS;
Integrated Security=true;AttachDBFilename=|DataDirectory|TestDB.mdf;
User Instance=false;MultipleActiveResultSets=True"/>
<add name="TestDBEntities"
connectionString="metadata=res://*/TestDB.csdl|res://*/TestDB.ssdl|res://*/TestDB.msl;
provider=System.Data.SqlClient;
provider connection string="Data Source=.\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\TestDB.mdf;
Integrated Security=True;User Instance=false;
MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
Missing open angle bracket on each connection string is deliberate here and is because of a limitation of SO.
Any ideas how I can get around this?