views:

52

answers:

0

I am getting this error: Parser Error Message: An attempt to attach an auto-named database for file C:....\Database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

This is the relvent code from web.config file:

<connectionStrings>
  <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf" providerName="System.Data.SqlClient"/>
</connectionStrings>

<providers>
  <add name="AspNetSqlSiteMapProvider" type="SqlSiteMapProvider2"  securityTrimmingEnabled="true"  connectionStringName="LocalSqlServer"  sqlCacheDependency="CommandNotification"/>       
 </providers>

Is it happens because of User Instance?
if yes, how do I fix it?