将Web服务器升级到.net Framework 4.6.1时,与远程SQL Server的连接断开 [英] Connection to remote SQL server breaks when upgrading web server to .net framework 4.6.1

查看:56
本文介绍了将Web服务器升级到.net Framework 4.6.1时,与远程SQL Server的连接断开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在将asp.net Web应用程序(在IIS 7.5上托管)从.net Framework v4.5更新到v4.6.1.在较小的较低级环境/本地开发中,其中SQL Server与IIS在同一盒子上运行,此更新工作正常并且不会破坏任何内容.但是,一旦我们在从Web服务器远程托管SQL Server的测试环境中更新了Web服务器,我们的应用程序将无法再建立与数据库的连接.我们收到此错误:

We're currently working on updating our asp.net web application (hosted on IIS 7.5) from .net framework v4.5 to v4.6.1. On small lower environments/local development in which SQL server runs on the same box as IIS, this update works fine and does not break anything. However, once we update our web servers in our test environments which host SQL server remotely from our web servers, our application can no longer establish a connection to the database. We receive this error:

Connection Timeout Expired. The timeout period elapsed while attempting to
consume the pre-login handshake acknowledgement. This could be because the
pre-login handshake failed or the server was unable to respond back in time.

该SQL Server运行的是CLR版本v4.0.30319.我们使用Entity Framework版本6.0.0.0进行数据访问,并且连接字符串均使用集成安全性.我们是否还需要将托管SQL Server的服务器箱也更新为.net 4.6.1?我不知道为什么对于我们的应用程序建立与数据库的连接来说是必要的,但是我一直无法在MSDN上找到关于此的任何指导.

The SQL server is running with CLR version v4.0.30319. We use Entity Framework version 6.0.0.0 for data access, and the connection strings all use integrated security. Do we need to update the boxes hosting SQL server to .net 4.6.1 also? I don't see why that would be necessary for our app to establish a connection to the database, but I've been unable to find any guidance on MSDN about this.

此故障后,我们将Web服务器降级为.net v4.5,并能够重新建立与SQL Server的连接.重新升级到v4.6.1导致再次损坏.因此,我们相对确定升级是问题所在,而不是应用程序代码和/或IIS设置的更改.

After this breakage, we downgraded our web servers back to .net v4.5 and we were able to re-establish a connection to SQL server. re-upgrading to v4.6.1 caused the breakage yet again. Therefore, we are relatively sure that the upgrade is the issue, and not a change in application code and/or IIS settings.

推荐答案

下面的文章介绍了.net 4.6.1中SQL Server连接的新默认连接字符串设置.

The following article describes a new default connection string setting for SQL Server connections in .net 4.6.1.

https://blogs.msdn.microsoft.com/dataaccesstechnologies/2016/05/07/connection-timeout-issue-with-net-framework-4-6-1-transparentnetworkipresolution/

这是为了解决某些环境中的一个问题,但也导致了您在其他环境中遇到的问题.

This was to solve one problem in some environments, but also caused the issue you are experiencing in other environments.

基本上,您需要添加以下连接字符串:

Basically, you'll want to add the following your connection string:

TransparentNetworkIPResolution=False;

这篇关于将Web服务器升级到.net Framework 4.6.1时,与远程SQL Server的连接断开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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