EF使用CodeFirst,当使用localDB时,删除mdf文件,会报“Cannot attach the file ‘{0}' as database '{1}'”错误。

解决方法如下:

1、打开Visual Studio 命令提示

2、sqllocaldb.exe stop v11.0

3、sqllocaldb.exe delete v11.0

然后重新生成数据库文件即可

Cannot attach the file ‘{0}' as database '{1}'的更多相关文章

  1. EF架构~Cannot attach the file as database

    回到目录 Cannot attach the file as database这个异常是在EF的code frist里经常出现的,解决方法很简单,只要重新启动一下V11实例即可. CMD> sq ...

  2. Cannot attach the file as database 'membership'.

    Cannot attach the file 'D:\GitHome\cae\CAE\App_Data\membership.mdf' as database 'membership'. 说明: 执行 ...

  3. Cannot attach the file as database

    Cannot attach the file as database这个异常是在EF的code frist里经常出现的,解决方法很简单,只要重新启动一下V11实例即可. CMD> sqlloca ...

  4. 异常处理:Cannot attach the file as database 'membership'.

    Cannot attach the file 'D:\GitHome\cae\CAE\App_Data\membership.mdf' as database 'membership'. 说明: 执行 ...

  5. SQL SERVER – Attach mdf file without ldf file in Database

    Background Story: One of my friends recently called up and asked me if I had spare time to look at h ...

  6. Cannot attach the file “MvcMovie.mdf” as database “aspnet-MvcMovie”

    今天在微软开发人员官网上学习asp.net mvc5入门的时候,遇到一个棘手的问题,我是按照教程一步一步操作的,但期间遇到一个自己觉得莫名其妙的问题,教程中也没有提到这个, 在添加新字段这一章节,跟着 ...

  7. RESTORE detected an error on page (0:0) in database

    在测试服务器还原生产服务器的一个数据库时遇到了下面错误: System.Data.SqlClient.SqlError: RESTORE detected an error on page (0:0) ...

  8. update-database时出现Cannot attach the file

    在进行Migrations时,如果直接删除了Db文件,在使用update-database时会出现Cannot attach the file发问题 解决方案:

  9. odoo-10.0 create database 失败

    在初始化数据库的界面点击[create database] create database 失败 报错如下 2017-01-05 20:15:18,529 4652 INFO ? werkzeug: ...

随机推荐

  1. 跟着百度学PHP[5]函数篇2-PHP中的特殊形式的函数

    目录...................................................... .00x1 可变函数 在PHP里面如果说将“函数名称”赋予字符串类型的变量.在调用这个 ...

  2. BZOJ 3771: Triple

    Description 问所有三/二/一元组可能形成的组合. Sol FFT. 利用生成函数直接FFT一下,然后就是计算,计算的时候简单的容斥一下. 任意三个-3*两个相同的+2*全部相同的+任意两个 ...

  3. linux git实现代理

    说明  Git 目前支持的三种协议 git://.ssh:// 和 http://,使用git:// 和 http://比较多,ssh://忽略,FQ后可以直接加快同步google和github代码. ...

  4. maven中classpath路径(转)

    前几天看见一个大神总结classpath文章,觉得特别有用.所以,特此转载(http://my.oschina.net/GivingOnenessDestiny/blog/603505) 各种path ...

  5. selenium webdriver 右键另存为下载文件(结合robot and autoIt)

    首先感谢Lakshay Sharma 大神的指导 最近一直在研究selenium webdriver右键菜单,发现selenium webdriver 无法操作浏览器右键菜单,如图 如果我想右键另存为 ...

  6. (三)Netty源码学习笔记之boss线程处理流程

    尊重原创,转载注明出处,原文地址:http://www.cnblogs.com/cishengchongyan/p/6160194.html  本文我们将先从NioEventLoop开始来学习服务端的 ...

  7. iOS 对象的内存管理细节

    通过类创建对象 1.创建对象时,开辟存储空间,通过new方法创建的对象会在 堆 内存中开辟一块存储空间 2初始化所有属性都在堆内存中完成 3.返回值真地址,指针在栈内存中,指针指向的地址是堆里创建对象 ...

  8. MMAP和DIRECT IO区别

    看完此文,题目不言自明.转自 http://blog.chinaunix.net/uid-27105712-id-3270102.html 在Linux 开发中,有几个关系到性能的东西,技术人员非常关 ...

  9. 解决ftp上传connection reset错误

    切换到管理员,cmd下面执行:netsh advfirewall set global StatefulFTP disable MS对此的解释:https://technet.microsoft.co ...

  10. FOJ 2181 快来买肉松饼

    链接:http://acm.fzu.edu.cn/problem.php?pid=2181 思路:乍一看以为是并查集,仔细想了下又找不到让函数结束的条件,所以就看了其他人的搜索大法 #include ...