Quote:
Originally Posted by Imar
What you see is by design. ASP.NET uses a connection string called LocalSqlServer by default for Membership.
You can store the database in C:\Data\SqlServer, attach it to SQL Server and then configure your application to look at that database.
Not sure why these database files don't have an extension. Maybe Windows is configured to hide extensions for known file types?
Probably a configuration issue. What do you have under Tools | Options | Database tools | Data connections? Make sure the instance name aligns with the SQL Server instance you're using.
|
Hi Imar,
This should really not be this hard!!
I deleted the aspnetdb from my app_data folder but VS put it back in again when I ran my website even though I have both "School" and "aspnetdb" in my C:\data\sqlserver folder and both attached via the SQL mgt tool. I also put a connection string in my web.config file (see below). In SQL mgt tool the names are shown as:
ASPNETDB.MDF and School
In the VS Server Explorer they are shown as:
mypc\sqlexpress.ASPNETDB.MDF.dbo
mypc\sqlexpress.School.dbo
In my File Explorer in C:\data\sqlserver explorer they are shown as :
ASPNETDB.MDF and School.mdf
In my Tools | Options | Database tools | Data connections I have:
mypc\sqlexpress - and obviously this is working for the School DB
And, no I my windows does not hide known file types
Here is how my config file looks now - per page 771:
<connectionStrings>
<clear />
<add name="SchoolConnectionString1" connectionString="Data Source=mypc\sqlexpress;Initial Catalog=School;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="SchoolEntities" connectionString="metadata=res://*/App_Code.SchoolModel.csdl|res://*/App_Code.SchoolModel.ssdl|res://*/App_Code.SchoolModel.msl;provider=System.Data.SqlC lient;provider connection string="data source=mypc\sqlexpress;initial catalog=School;integrated security=True;multipleactiveresultsets=True;App=En tityFramework"" providerName="System.Data.EntityClient" />
<add name="LocalSqlServer" connectionString="Data Source=mypc\sqlexpress;Initial Catalog=aspnetdb.mfd.dbo;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
I've tried every variation of aspnetdb sufix and the one currently in my config file is just one variation. No matter what, I now get this error:
Cannot open database "aspnetdb.mfd.dbo" requested by the login. The login failed.
Login failed for user 'mypc\myUserName'. Description: An unhandled exception occurred during the execution of the current web request....
Exception Details: System.Data.SqlClient.SqlException: Cannot open database "aspnetdb.mfd.dbo" requested by the login. The login failed. Login failed for user 'mypc\myUserName'.
Any help will be much appreciated.