The timeout period elapsed prior to completion of the operation or the server is not responding.

问题:更新数据的状态值时,部分报出如下异常:

The timeout period elapsed prior to completion of the operation or the server is not responding.

即时有成功更新,时有报错问题出现。

在LOG中发现成功更新的数据,存在更新时间过长问题,将近30秒(EF默认的CommandTimeout为30秒):

The timeout period elapsed prior to completion of the operation or the server is not responding.

代码如下:

The timeout period elapsed prior to completion of the operation or the server is not responding.

只是简单的更新,即出现如此长时间的更新等待。

================================================================================

更新优化,加上一个排除条件(该条件的数据量过多),解决上面更新时间过长和报错的问题:

The timeout period elapsed prior to completion of the operation or the server is not responding.

The timeout period elapsed prior to completion of the operation or the server is not responding.

函数链语法糖,书写舒服,问题埋坑