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. CMD> sqllocaldb.exe start v11.0 LocalDB instance "v11.0" started.
再次运行应用程序,搞定!
本文转自博客园张占岭(仓储大叔)的博客,原文链接:EF架构~Cannot attach the file as database,如需转载请自行联系原博主。