C# asp.net 连接 Sql Server数据库 Timeout expired. 错误,怎么办?
连接数据库时出现
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. The duration spent while attempting to
connect to this server was - [Pre-Login] initialization=0;
handshake=14997;
提示
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. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=14997;
提示
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. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=14997;
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;
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)
原因:
.net core 的System.Data.SqlClient支持的最低SqlServer版本是2008 r2 SP3,小于这个版本的就会报这个错。
解决
方式1:.netcore 连接使用 sqlserver
.net core 的System.Data.SqlClient支持的最低SqlServer版本是2008 r2 SP3 请先检查数据库版本
方式2:通过sqlserver控制管理工具,重启sqlserver服务进程
其他信息
Microsoft SQL Server 2008 R2 (SP1)
10.50.2550.0 (X64) Jun 11 2012 16:41:53 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)
Connection string:
Data Source=192.168.1.6;Initial Catalog=DBName;Persist Security Info=False;User ID=username;Password=pass
This issue may be related to #16528.
Unfortunately, we cannot upgrade our SQL server service pack. The same application works fine on Windows. This also impacts Entity Framework .
Code:
using (SqlConnection connection = new SqlConnection(connectionString))
{SqlCommand command = new SqlCommand(queryString, connection);connection.Open();SqlDataReader reader = command.ExecuteReader();try{while (reader.Read()){Console.WriteLine(String.Format("{0}, {1}",reader["Id"], reader["Email"]));}}catch(Exception ex){Console.WriteLine(ex.ToString());}
}
C# asp.net 连接 Sql Server数据库 Timeout expired. 错误,怎么办?相关推荐
- asp教程连接sql server数据库教程二种方法
asp教程连接sql server数据库教程二种方法 ,sql server ole db连接方法:,本人链接sql2012已经成功,想可以帮助大家 本教程主要是讲了asp与mssql server ...
- 【ASP.NET】VS2015连接SQL Server数据库,实现登录、注册
文章目录 1. 实验目标 2. 难点 3. 问题 3.1 SQL Server 3.2 Demo练习 3.3 编写页面时的错误 4. 总结 5. 页面 6. 主要代码 [ASP.NET]VS2015连 ...
- ADO.NET连接SQL Server数据库
在.NET应用程序中,创建数据连接分为三步: 一.定义连接字符串 不同的数据库连接字符串的格式不同,一般都包括要连接的数据库提供都名称.登陆信息以及要使用的数据库名称. 注意:在定义连接字符串之前,一 ...
- python 使用pymssql连接sql server数据库
Python连接SQL Server数据库 - pymssql使用基础 ----原文地址:http://www.cnblogs.com/baiyangcao/p/pymssql_basic.html ...
- python连接sql数据库_python连接sql server数据库实现增删改查
简述 python连接微软的sql server数据库用的第三方模块叫做pymssql(document:http://www.pymssql.org/en/stable/index.html).在官 ...
- 今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个...
今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个 Failover Partner的选项.以前都没注意过,它的主要功能就是 ...
- dw连接mysql数据库原理_Dreamweaver中连接SQL Server数据库代码
Adobe Dreamweaver CS3连接ACCESS数据库 "Driver={Microsoft Access Driver (*.mdb)};Uid=;Pwd=;DBQ=" ...
- python数据库编程:Python基于Pymssql模块实现连接SQL Server数据库的方法详解
本文实例讲述了Python基于Pymssql模块实现连接SQL Server数据库的方法.分享给大家供大家参考,具体如下: 数据库版本:SQL Server 2012. 按照Python版本来选择下载 ...
- VS2019连接SQL Server数据库
VS2019连接SQL Server数据库 -web程序设计 ASP.NET 1. 安装SQL Server 可参考链接:SQL Server 2019 安装教程 2. 打开VS2019,创建项目 3 ...
最新文章
- 通过button返回一个action,跳转到一个view
- HDU 4405 Aeroplane chess(期望DP)
- tailf、tail -f、tail -F 指令
- 通俗理解T检验与F检验的区别【转】
- 【git】git compare with branch 一样的代码 但是却标识不一样 成块显示 Git 比较 不准确
- php 上传微信媒体,关于微信公众号API多媒体上传
- python爬虫实例
- 第一章 语音信号处理概述
- 手写汉字识别数据集的预处理
- 旧文重发:从第三方服务角度看各公司技术部门如何正确计算投入产出比~
- 【SSLGZ 2134】猫猫的小鱼
- DFT的简单介绍(上)
- oracle表独立数据文件,oracle表空间及数据文件
- PostgreSQL 数据库系列之二:PSQL客户端
- 达摩院技术创新全景|懂你的语音AI
- 氦起来!让数据充满力量!(内文有彩蛋)
- 商场/购物中心会员营销活动方案
- 软件产品版本命名规范
- OpenCPN介绍及编译
- ENVI+ArcGIS利用哨兵2图像做NDVI
热门文章
- 评估 OKRs 的最佳频率是什么?
- 用计算机绘图的注意事项,计算机绘图实践心得.doc
- 电脑网络设置出现红叉解决办法,详细步骤并配图,附网盘链接,亲测有效
- i9 10900K比9900K性能提升了多少?i9-10900K和i9-9900K区别对比评测 更多详情咨询世通兰陵王
- Eclipse(Windows)下第一个动态Java Web项目(Tomcat部署)
- python3 zlib 实现压缩与解压字符串与文件数据流
- 蓝牙耳机什么牌子好?2020年度热销高人气五款蓝牙耳机测评
- 计算机桌面下方标图,电脑下方怎么设置显示桌面图标
- python展开阅读全文_展开阅读全文 js 爬虫操作
- 微信电话语音质量 VS VOLTE语音质量