无法使用最新的 EntityFramework 连接到任何 SQL 实例
我刚刚更新了我的 EntityFramework EntityFramework.4.1.10331.0 到 EntityFramework.4.1.10715.0
使用此版本,我无法使用集成安全性或基于 SQL 的身份验证连接到本地计算机或各种远程计算机上的单个数据库实例。
如果我使用旧的 4.1.10331.0 版本,连接仍然可以正常工作。
我收到的具体错误如下,但是我连接到的实例都是默认实例。
发生网络相关或特定于实例的错误 建立与 SQL Server 的连接。找不到服务器或 无法访问。验证实例名称是否正确 SQL Server 配置为允许远程连接。 (提供者:SQL 网络接口,错误:26 - 定位服务器/实例时出错 指定)
基于 My SQL 的身份验证连接字符串如下所示
服务器=本地主机;数据库=数据库名;UID=用户名;PWD=密码;
有没有其他人遇到过这个问题或者有人可以提出可能的原因吗?
I've just updated my EntityFramework from
EntityFramework.4.1.10331.0
to
EntityFramework.4.1.10715.0
With this version I can't connect to a single database instance on my local machine or a variety of remote machines, using either integrated security or SQL based authentication.
Connections still work fine if I use the the old 4.1.10331.0 release.
The specific error I get is below, however the instances I'm connecting to are all default instances.
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
My SQL based authentication connection string looks as follows
Server=localhost;Database=dbname;UID=username;PWD=password;
Has anyone else ran across this or can anyone suggest possible causes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您的连接字符串指定了
provider
属性:Make sure your connection string has the
provider
attribute specified:我设法让它工作,但我仍然不完全确定其背后的原因是什么。我认为这可能与 Yuck 建议的 Provider 配置有关。
针对 4.1.10331.0 版本,我在 DBContext 上设置连接字符串,如下所示,效果很好。
但是,对于版本 4.1.10715.0,这将导致错误:26 - 定位服务器/实例指定的异常异常。
现在,我将连接字符串传递到上下文的构造函数中,上下文又将其传递到其基本构造函数中。然后一切都按预期正常工作。
I managed to get this working however I'm still not totally sure what the reasoning behind it is. I think it may perhaps be related to a Provider configuration as suggested by Yuck.
Against the 4.1.10331.0 build I was setting the connectionstring on the DBContext as follows and it worked fine.
However, against build 4.1.10715.0 this would result in the error: 26 - Error Locating Server/Instance Specified exception.
I now pass the connectionstring into the constructor of my context, which in turn passed that onto its base constructor. Everything then works fine as expected.