Connection open error (为什么dapper连接没问题呢?) 返回
开发环境:使用的sqlSugar5.0.0.15。用的core3.1。疑问,是不是只能用sqlsugarcore版本的
English Message : Connection open 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. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=47; handshake=14952;
Chinese Message : 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,实在找不到原因请先Google错误信息: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=47; handshake=14952; .
Exception:
at SqlSugar.AdoProvider.<GetDataReaderAsync>d__102.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at SqlSugar.QueryableProvider`1.<GetDataAsync>d__189`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at SqlSugar.QueryableProvider`1.<_ToListAsync>d__181`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Exam.DataFactory.Repository.Imp.DataBaseRepository`1.<Query>d__13.MoveNext() in D:\project\Exam.DataFactory\Repository\Imp\DataBaseRepository.cs:line 285
ConnString:Data Source=xxx;Initial Catalog=project;User Id=sa;Password=123456;
热忱回答(2)
-
初学者 VIP0
2020/6/17/// <summary>
/// 主库连接
/// </summary>
/// <returns></returns>
public SqlSugarClient CreateExamConnection()
{
var dataConfig = ConnectionFactory.MutiConnectionString.FirstOrDefault(x => x.Name.Equals(EnumDataType.Exam.ToString()));
var connString = dataConfig.Enabled ? dataConfig.ConnectionTest : dataConfig.Connection;
return new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = connString, //cfg["connectionString"],
DbType = DbType.SqlServer,
IsAutoCloseConnection = true, // 查询完之后自动释放数据库
IsShardSameThread = true,//相同线程是同一个sqlsugarclient
InitKeyType = InitKeyType.Attribute,
ConfigureExternalServices = new ConfigureExternalServices()
{
// DataInfoCacheService = new RedisCache()
}
});
}
0 回复 -
初学者 VIP0
2020/6/27升级到最新版本解决。
0 回复