bevacqua
bevacqua

Reputation: 48566

ASP.NET Attempt to attach auto-named a database failed?

Parser Error Message: An attempt to attach an auto-named database for file D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Why could this be happening? My connection string doesn't use |DataDirectory|, it is:

<connectionStrings>
  <add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>

I get this error when I try to load default.aspx, after installing BugNET.

Upvotes: 1

Views: 1736

Answers (2)

bevacqua
bevacqua

Reputation: 48566

Apparently, and certainly for some obscure reason. There is a mistery connection string coming from... nowhere.

Problem solved adding a <clear/> tag.

<connectionStrings>
  <clear/>
  <add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>

Upvotes: 1

marc_s
marc_s

Reputation: 755471

file D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data**aspnetdb.mdf** failed.

This is the ASP.NET standard membership system here - not your "regular" database. There must be a second connection string somewhere that references this aspnetdb.mdf and tries to attach it from a file.

Search your solution for this file name - it must be somewhere!

Upvotes: 0

Related Questions