是这样的,最近我在开发Api(重构),用的数据库是Sqlserver,使用的Orm是 SqlSugar(别问我为什么选这个,boss选的同时我也想支持国人写的东西,且文档也很全)。

被催的是,写好了程序本地(windows10 pro 64 bit)运行正常,一部署到测试机器(centos7.2 64 bit)就报错:

报错1

An unhandled exception occurred while processing the request.

SqlSugarException: English Message : Connection open error . Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=48; handshake=124; [Login] initialization=0; authentication=0; [Post-Login] complete=14000;
Chinese Message : 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,实在找不到原因请先Google错误信息:Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=48; handshake=124; [Login] initialization=0; authentication=0; [Post-Login] complete=14000; .

如图:

wtf!!!:为毛本地好好的,一丢到linux测试机(后面简称测试机)就出问题???

然后,我开始痛苦的排查了,从环境、框架,依赖注入,数据库网络;

telnet ping啊那些不用说了;

1、换台测试机 --> 测试机一样报错(排除本机玄学原因);

2、更新SqlSugar版本,从4.9.7更新到4.9.8.1--> 本地正常、测试机一样报错(基本排除驱动特地版本的bug);

3、用程序连接查询同网段的其他数据库 --> 本地正常、测试机一样报错(基本也排除网络原因);

4、连接我自己远程服务器的数据库 --> 本地正常、测试机正常--(排除linux驱动工作不正常或者程序时bug)

最后,我想想一直报超时。我都没增加超时时间(默认应该是15秒),我在连接字符串里面加了一个

Connect Timeout=300;//5分钟的超时时间

得,报的错变成了:

报错2

An unhandled exception occurred while processing the request.

SqlSugarException: English Message : Connection open error . A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 35 - An internal exception was caught)
Chinese Message : 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,实在找不到原因请先Google错误信息:A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 35 - An internal exception was caught).

SqlSugar.AdoProvider.GetDataReader(string sql, SugarParameter[] parameters)

如图:

各种玄学的非玄学的方法都找完了,差点想提前打包回家了,我突然灵光一闪??会不会数据库版本问题!!!

最后发现了这个,

.net core 的System.Data.SqlClient支持的最低SqlServer版本是2008 r2 SP3,小于这个版本的就会报这个错。

来源:

https://github.com/dotnet/corefx/issues/9719

结论:

.netcore 连接使用sqlserver遇到以上报错1、报错2的同学,需注意:.net core 的System.Data.SqlClient支持的最低SqlServer版本是2008 r2 SP3请先检查数据库版本。

呼~这个鬼问题浪费了我整整两天+(3个熬夜)。

Connection open error . Connection Timeout Expired. The timeout period elapsed during the post-login phase.的更多相关文章

  1. SQLSERVER:Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

    背景: 在最近开发中遇到一个问题,对一个数据库进行操作时,我采用64个并行的任务每个任务保证一个数据库连接对象:但是每个任务内部均包含有24个文件需要读取,在读取文件之后,我们需要快速将这24个文件批 ...

  2. SSRS 2008 R2 错误:Timeout expired. The timeout period

    今天遇到了Reporting Services(SQL SERVER 2008 R2)的报表执行异常情况,报表加载数据很长时间都没有响应,最后报"An error occurred with ...

  3. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    今天碰到了一个查询异常问题,上网查了一下,感谢原创和译者 如果你使用的数据库连接类是 the Data Access Application Blocks "SqlHelper" ...

  4. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.【转】

    今天碰到了一个查询异常问题,上网查了一下,感谢原创和译者 如果你使用的数据库连接类是 the Data Access Application Blocks "SqlHelper" ...

  5. 网站错误记录:Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool.

    今天看公司项目的错误日志文件,发现日志文件都是记录的这个错误. 经过网站查找,发现英文翻译是: 译:超时,与连接池的连接时间已过.这种情况发生是因为连接池在使用和最大连接池数目已满 通过翻译,可以看出 ...

  6. 解决 Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 的问题

    在web 网站开发中,经常需要连接数据库,有时候会出现这样的数据连接异常消息: 主要原因是 应用程序与数据库的连接超出了数据库连接的默认时长,在这种情况下,我们可以把数据库连接的时长延长一些,因为 C ...

  7. [bug]Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

    写在前面 在mysql中这个异常是非常常见的,超时分为连接超时和执行超时,而连接超时,大部分原因是网络问题,或客户端到服务端的端口问题造成. bug场景 有的时候,使用MySqlDataReader在 ...

  8. .net core linux环境下 System.Data.SqlClient.SqlException: Connection Timeout Expired.

    最近遇到了一个很奇葩的问题,我编写了一个.net core程序读取多个数据库数据源,进行数据同步处理.该程序在windows环境下运行完全正常,但在linux环境下运行报异常,提示 System.Da ...

  9. 连接池和 "Timeout expired"异常

    转自:博客园宁静.致远:http://www.cnblogs.com/zhangzhu/archive/2013/10/10/3361197.html 异常信息: MySql.Data.MySqlCl ...

随机推荐

  1. 深入理解CPP与C中bsearch函数的用法

    ·使用besearch函数的前提(一些废话) 首先让我们先亮出二分法的定义: https://baike.baidu.com/item/二分法/1364267 以及二分法实现的方法: https:// ...

  2. 我的 FPGA 学习历程(08)—— 实验:点亮单个数码管

    数码管是一种常见的用于显示的电子器件,根据数码管大致可以分为共阴极和共阳极两种,下图所示的是一个共阳极的数码管的电路图(摘自金沙滩工作室的 51 开发板电路图),我的 AX301 开发板与这张图的情况 ...

  3. 如何让pandas表格直接转换为markdown表格

    https://stackoverflow.com/questions/33181846/programmatically-convert-pandas-dataframe-to-markdown-t ...

  4. java方法的调用

    各种方法的调用实例 package cn.edu.fhj.day004; public class FunctionDemo { // 定义全局的变量 public int a = 3; public ...

  5. Jquery weui picker 支持label和value

    万年没更新了. 最近用jquery weui. 在使用picker时需要一些问题. 就是让picker 显示label, 但是取值的时候取value用于存储. 官网例子如下 Jquery-weui 官 ...

  6. 201771010126 王燕《面向对象程序设计(Java)》第十四周学习总结(测试程序11)

    实验十四  Swing图形界面组件 理论部分: 不使用布局管理器 有时候可能不想使用任何布局管理器,而只 是想把组件放在一个固定的位置上.下面是将一 个组件定位到某个绝对定位的步骤: 1)将布局管理器 ...

  7. DHCP工作原理简析

    引言 DHCP是网络体系结构中应用层的一个重要协议,它可以帮助我们对要连接到互联网的计算机进行IP地址等信息的配置.本文从DHCP的原理出发,就DHCP的工作过程 进行详细的探讨. 主要报文 发现报文 ...

  8. Java for Android 第二周课上实验一

    (一)命令行下程序开发 (二)IDEA下程序开发调试 Mac OS系统下使用的IDEA为 Netbeans (三)测试题我的学号后两位为10 使用简单的PHP小程序得我的题目为2:实现简单四则运算(能 ...

  9. [LeetCode] Fibonacci Number 斐波那契数字

    The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such th ...

  10. AJAX-同源策略 跨域访问

    ## 同源策略 概述: 同源策略是浏览器的一种安全策略,视为同源是指域名,协议,端口完全相同.只有同源的地址才可以通过AJAX方式请求.同源或者不同源说的是两个地址的关系,不同源地址之间请求我们称之为 ...