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