Coldairarrow / EFCore.Sharding

Database Sharding For EFCore
Apache License 2.0
694 stars 144 forks source link

线上环境出现An exception occurred while iterating over the results of a query for context type 'EFCore.Sharding.GenericDbContext'. #103

Closed wsiscool closed 3 years ago

wsiscool commented 3 years ago

System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Connect Timeout expired. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Connect Timeout expired. ---> System.ObjectDisposedException: Cannot access a disposed object. 具体报错如上,我看EFCore的解决方案是增加重试机制,EfCoreSharing有重试机制的使用方法吗

环境:数据库是主主,连接字符串走的浮动IP