尝试附加自动命名的数据库文件****失败 [英] An attempt to attach an auto-named database file **** failed
问题描述
![具有相同名称的项目或在UNC共享上存在] [1]
![Item with same name exist or on UNC share][1]
以前我已经安装了VS-2015,但是在我的研究所我创建了数据库2013 VS,所以VS 15没有打开数据库,所以我安装了2k13,现在安装后,数据库给出了此错误。请帮我解决。早日的响应将不胜感激
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
推荐答案
您可以检查两个地方来解决此问题:
There's two places you can check to fix this:
- 在web.config中的connectionString中,检查connectionString值。在VS2015中,(LocalDb)可能已更改,因此(对于VS2015)应为:
Data Source =(LocalDb)\ MSSQLLocalDB; AttachDbFilename = | DataDirectory | \MyDatabase.mdf; Integrated Security = True
Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True
- 另一个要更改的地方是进一步在web.config中找到EntityFramework部分和defaultConnectionFactory并将参数更改为:
在VS2013中,web.config的两个部分可能都将其设置为11.0。
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.
这篇关于尝试附加自动命名的数据库文件****失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!