EntityFramework - Cannot attach the file as database
Cannot attach the file as database这个异常是在EF的code frist里经常出现的,解决方法很简单,只要重新启动一下V11实例即可。
CMD> sqllocaldb.exe stop v11.0 LocalDB instance "v11.0" stopped. CMD> CMD> sqllocaldb.exe delete v11.0 LocalDB instance "v11.0" deleted. 到这步就可以用update-database -verbose 命令去执行生成数据库
CMD> sqllocaldb.exe start v11.0 LocalDB instance "v11.0" started.
实际解决问题过程中,不一定仅有v11.0一个实例,可以用命令
SqlLocalDB.exe info 查看有几个实例,如果停止和删除v11.0,则试试停止和删除其它实例试试。