An attempt to attach an auto-named database file *

2019-09-18 02:12发布

问题:

![Item with same name exist or on UNC share][1]

previously i had installed VS - 2015 , but at my institute i created my database in 2013 VS , so VS 15 was not opening the database , so i installed the 2k13, Now after installing ,database gives this error. Kindly help me out.An early response will be greatly appreciated

回答1:

There's two places you can check to fix this:

  1. In your connectionString in web.config check the connectionString value. In VS2015 the (LocalDb) might have changed so it should be (for VS2015) this:

Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True

  1. The other place to change is further down in web.config find the entityFramework section and the defaultConnectionFactory and change the parameter to this:

With VS2013 it might have been set to 11.0 in both parts of web.config.

Re-run your application and this should solve the problem. If not post more details about the problem.