此操作需要连接到“主”数据库 [英] This operation requires a connection to the 'master' database

查看:364
本文介绍了此操作需要连接到“主”数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



错误是:


此操作需要连接到主数据库。由于原始的
数据库连接已被打开并且凭据已从连接字符串中删除
,所以无法
创建与主数据库的连接。提供未打开的连接。


代码中没有任何变化 - 数据库访问在整个代码的其余部分都很好。 >

它停止在这一行上:

  var filteredContacts = dc.EAContactLists.Where (o => teams.Contains(o.Team))。ToList(); 

我失去了这一个。

解决方案

尝试在连接字符串中设置 Persist Security Info = True



希望这有帮助。


I have suddenly started getting an error in my asp.net MVC 4 web application.

The error is:

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.

Nothing has changed in the code - and database access is fine throughout the rest of the code.

It stops on this line:

var filteredContacts = dc.EAContactLists.Where(o => teams.Contains(o.Team)).ToList();

I am lost on this one.

解决方案

Try setting Persist Security Info = True in your connection string.

Hope this helps.

这篇关于此操作需要连接到“主”数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆