EF Core large queries throwing transport-level error

66 Views Asked by At

I am porting over code from a .NET Framework project to .NET 8 and I'm seeing the following error:

A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)

While I've read through several of the other posts related to this exception I'm still not sure what the real problem is. I have a pretty simple query:

await _dbContext
    .Set<Setting>()
    .Where(setting => setting.Type == type)
    .ToListAsync(cancellationToken);

If I limit the query to fewer than 80 records, I do not get this error but any more than that and I start to get it, also if I remove "MultipleActiveResultSets=True;" from my connection string the error goes away.

I'm not sure I should get rid of that setting and I don't think the amount of data is large enough to warrant this exception.

Is there a reason that MultipleActiveResultSets would throw this error when using Entity Framework Core when it worked fine before?

0

There are 0 best solutions below