是这样的,最近我在开发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. 【C语言编程练习】5.12 兔子产仔问题

    1. 题目要求 把一对新生的兔子关在屋子里,已知一对两个月大的兔子以后买一个月可以生一对小兔子,而这一对心生的小兔子初生两个月以后才可以生小兔子,假如一年内没有死亡,一年可以繁殖成多少对? 2. 题目 ...

  2. BZOJ.4144.[AMPPZ2014]Petrol(Kruskal重构树)

    BZOJ 看别人代码的时候发现哪一步都很眼熟,突然想起来,就在四个月前我好像看过还给别人讲过?mmp=v= 果然不写写就是容易忘.写了好歹忘了的时候还能复习呢(虽然和看别人的好像也没多少差别?). 首 ...

  3. 阿里云服务器 yii2执行composer提示报错

    未解决 composer installLoading composer repositories with package informationUpdating dependencies (inc ...

  4. 关于JQ中,新生成的节点on绑定事件失效的解决

    老旧的JQ库在做新生成DIV的click事件绑定,需要先绑定其现有的父元素,在追踪到需要事件绑定的子节点上 如以下这段代码$(".t_in").on("click&quo ...

  5. Oracle、DB2、SQLSERVER、Mysql、Access分页SQL语句

    最近把平时在项目中常用到的数据库分页sql总结了下.大家可以贴出分页更高效的sql语句.sqlserver分页  第一种分页方法 需用到的参数:  pageSize 每页显示多少条数据  pageNu ...

  6. 安装xlwt和xlrd

    因为想用python实现读写excel.百度了下,要安装xlwt和xlrd,网上各种方法,很多都不便利.最后利用pip安装很方便. 第一步:浏览器检索“xlwt安装”,点击第一个网页(百度) 即出现如 ...

  7. Makefile = ?= := 区别 $@,$^,$<

    = 是最基本的赋值:= 是覆盖之前的值?= 是如果没有被赋值过就赋予等号后面的值+= 是添加等号后面的值 1.“=” make会将整个makefile展开后,再决定变量的值.也就是说,变量的值将会是整 ...

  8. Anaconda虚拟环境

    创建虚拟环境:conda create -n env_name packages 例:创建名为env1的虚拟环境,并在其中安装numpy,conda create -n env1 numpy. 指定特 ...

  9. day03笔记

    1.list操作stus = ['xiaohei','xiaobai','xiaohuang','cxdser'] #数组.list.array#增加stus.append('原宝')#在list末尾 ...

  10. MVVM简介与运用

    在介绍MVVM框架之前,先给大家简单介绍一下MVC.MVP框架(由于本博文主要讲解MVVM,所以MVC和MVP将简化介绍,如果需要我将在以后的博文中补充进来). MVC框架: M-Model : 业务 ...