diff --git a/src/SqlSessionStateProviderAsync/SqlSessionStateRepository.cs b/src/SqlSessionStateProviderAsync/SqlSessionStateRepository.cs index 1b0cd8f..045a9f2 100644 --- a/src/SqlSessionStateProviderAsync/SqlSessionStateRepository.cs +++ b/src/SqlSessionStateProviderAsync/SqlSessionStateRepository.cs @@ -492,11 +492,13 @@ public async Task GetSessionStateItemAsync(string id, bool exclusiv { using (var reader = await SqlSessionStateRepositoryUtil.SqlExecuteReaderWithRetryAsync(connection, cmd, CanRetryAsync)) { - if (await reader.ReadAsync()) + // use the synchronous versions of Read and GetFieldValue because of performance issues with + // large data described here: https://github.com/dotnet/SqlClient/issues/593 + if (reader.Read()) { // Varbinary(max) should not be returned in an output parameter // Read the returned dataset consisting of SessionItemLong if found - buf = await reader.GetFieldValueAsync(0); + buf = reader.GetFieldValue(0); } }