【发布时间】:2023-02-02 18:05:26
【问题描述】:
尝试对 linQ 使用异步等待时遇到这些错误
An error occurred using the connection to database '"xxx"' on server '"xxxx"
An exception occurred while iterating over the results of a query for context type '"AspectCore.DynamicGenerated.DbContext"'
这是遇到上述错误的代码:
List<RainingEvent> rainingEvents = await _dbUnitOfWork.RainingEventRepository.Get().ToListAsync();
当我尝试删除异步等待时,它能够从数据库中获取数据
连接字符串:"data source=xxx;initial catalog=xxx;persist security info=True;user id=xxx;password=xxx;MultipleActiveResultSets=True;App=EntityFramework"
我做过的事情:
- 在 SQL 服务器配置中启用 TCP\IP 侦听
【问题讨论】:
标签: c# database entity-framework linq async-await