Запрос «IntegrationEventLogs» к «eshopOnContainters» вызывает выполнение «Timeout Expired» на SQL Server.C#

Место общения программистов C#
Ответить
Anonymous
 Запрос «IntegrationEventLogs» к «eshopOnContainters» вызывает выполнение «Timeout Expired» на SQL Server.

Сообщение Anonymous »

Когда у меня в базе данных > 6000 записей IntegrationEventLogs и я нажимаю на эту строку:

Код: Выделить всё

var result = await _integrationEventLogContext.IntegrationEventLogs
.Where(e => e.TransactionId == tid &&
e.State == EventStateEnum.NotPublished)
.ToListAsync();
в ходе обычного выполнения я получаю следующую ошибку и трассировку стека:

Код: Выделить всё

Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
---> System.ComponentModel.Win32Exception (258): The wait operation timed out.
at Microsoft.Data.SqlClient.SqlCommand.c.b__208_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at IFMS.GMT.BuildingBlocks.IntegrationEventLogEF.Services.IntegrationEventLogService.RetrieveEventLogsPendingToPublishAsync(Guid transactionId) in D:\repos\IntegratedFleetManagementSystem.GMT\src\BuildingBlocks\BuildingBlocks.IntegrationEventLogEF\Services\IntegrationEventLogService.cs:line 38
at IFMS.GMT.Services.VehicleManagement.WebAPI.Application.IntegrationEvents.VehicleManagementIntegrationEventService.PublishEventsThroughEventBusAsync(Guid transactionId) in D:\repos\IntegratedFleetManagementSystem.GMT\src\Services\VehicleManagement\VehicleManagement.WebAPI\Application\IntegrationEvents\VehicleManagementIntegrationEventService.cs:line 38
at IFMS.GMT.Services.VehicleManagement.WebAPI.Application.Behaviors.TransactionBehaviour`2.c__DisplayClass4_0.d.MoveNext() in D:\repos\IntegratedFleetManagementSystem.GMT\src\Services\VehicleManagement\VehicleManagement.WebAPI\Application\Behaviors\TransactionBehaviour.cs:line 61
--- End of stack trace from previous location ---
Этот запрос медленный? (если да, то есть ли какие-либо рекомендации по его улучшению), потому что я пытался создать индекс для TransactionId, но все равно не вижу улучшения.
Или моя машина вместе с запущенным экземпляром SQL Server.

Подробнее здесь: https://stackoverflow.com/questions/750 ... ion-timeou
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»