Entity Framework 4 此操作要求连接到 'master' 数据库错误解决方案


在第一次运行程序时,用Entity Framework进行修改和删除时总会报一次 此操作要求连接到 'master' 数据库错误 

再次修改或者删除就不会出现此错误 
因为Entity Framework 4也是第一次使用  这错误也找了很久 
今天有点时间,就耐着性子去google解决办法
找了很久 最后在一个老外的评论回复里找到解决办法

"This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection."

I had this error and solved it by adding "Persist Security Info=true" to the connection string.

意思是在连接字符串上要加 Persist Security Info=true

Persist Security Info=true 的意思是让.net一直保存着连接密码,默认是为false的

只是不明白 为什么在出现一次错误后 第二次就不会出现 难道出现过错误 .net就自动把密码给保存上了?


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值