3
我们一直在呼吁SaveChanges
实体框架得到间歇性的超时,我决定打开Database.Log
上DbContext
,试图找出发生了什么事情,输出率为:实体框架间歇超时在调用SaveChanges
Opened connection at 5/9/2015 4:56:57 PM +00:00
Started transaction at 5/9/2015 4:56:57 PM +00:00
UPDATE [Search].[IndexingStatuses]
SET [DateTimeLastUpdated] = @0, [IndexStores_IndexStoreId] = @1
WHERE ([CustomerId] = @2)
-- @0: '5/9/2015 4:03:57 PM' (Type = DateTime2)
-- @1: '2' (Type = Int16)
-- @2: '1' (Type = Int32)
-- Executing at 5/9/2015 4:56:57 PM +00:00
-- Completed in 1 ms with result: 1
Failed to commit transaction at 5/9/2015 4:57:13 PM +00:00 with error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Closed connection at 5/9/2015 4:57:13 PM +00:00
这很奇怪,它是一个简单的更新,你可以看到事务在4:56:57开始,更新需要1 ms,但由于某种原因,在4:57:13有一个超时只有16秒后,这比我们的超时限制还要少。
有谁知道我们为什么间歇性地得到这些?
您是否正在使用TransactionScope? – ESG
没有交易范围 – user351711
嗯。需要看代码才能知道发生了什么。 – ESG