FreeSql
FreeSql copied to clipboard
CentOS8 ODBC SqlServer2008 不定时会数据库连接失败
服务站点迁移到Linux上,使用了FreeSql。 在执行数据同步任务时,每天总有那么几次有数据库访问失败的情况。
Microsoft SQL Server 2008 R2 (RTM) Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
<PackageReference Include="FreeSql" Version="2.5.200" />
<PackageReference Include="FreeSql.Provider.Odbc" Version="2.5.200" />
<PackageReference Include="FreeSql.Provider.SqlServer" Version="2.5.200" />
<PackageReference Include="FreeSql.Repository" Version="2.5.200" />
<TargetFramework>net5.0</TargetFramework>
unixODBC 2.3.7
2021-07-29 00:41:03.969 +08:00 [ERR] Connection id "0HMAFST429CPC", Request id "0HMAFST429CPC:00000002": An unhandled exception was thrown by the application.
System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。ERROR [08001] [FreeTDS][SQL Server]Unable to connect to data source
---> System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。ERROR [08001] [FreeTDS][SQL Server]Unable to connect to data source
at FreeSql.Odbc.SqlServer.OdbcSqlServerConnectionPoolPolicy.OnGetAsync(Object`1 obj)
at FreeSql.Internal.ObjectPool.ObjectPool`1.GetAsync()
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func`3 fetchHandler, Action`2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at HttpReports.DefaultHttpReportsMiddleware.InvokeHttpCommonAsync(HttpContext context)
at HttpReports.DefaultHttpReportsMiddleware.InvokeHttpAsync(HttpContext context)
at HttpReports.DefaultHttpReportsMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
这个问题比较深入,尽量不要在 linux 用 windows 上标配的技术 odbc。
同样的问题,.net core,linux,链接postgresql
System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。Exception while connecting
---> System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。Exception while connecting
at FreeSql.Internal.ObjectPool.ObjectPool1.getFree(Boolean checkAvailable) at FreeSql.Internal.ObjectPool.ObjectPool
1.GetAsync()
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func`3 readerHander, CommandType cmdType, String cmdText, DbParameter[] cmdParms)
--- End of inner exception stack trace ---