环境为:

dotnet core 3.1 webapi efcore

maridb 10

Pomelo.EntityFrameworkCore.MySql

解决方案:

await _context.SaveChangesAsync();

异步操作要加await,不然会出现此异常。

参考:https://github.com/mysql-net/MySqlConnector/issues/496

It is not permitted to have multiple in-flight async operations on the same connection at the same time; you do have to await any existing operation before starting a new one.
However, you should also get a more helpful exception message (better than Packet received out-of-order) that helps you understand the problem and fix it. So if you are able to get a repro or a code sample that shows the problem, that would be good as it could help me identify where there is a missing check (for this invalid behaviour) in the code.
不允许同时在同一连接上进行多个进行中异步操作;您必须await任何现有的异步操作然后再开始一个新的操作。
但是,您还应该获得一条更有用的异常消息(比Packet received out-of-order这有助于你理解并解决问题。因此,如果您能够获得显示问题的repro或代码示例,那将是很好的,因为它可以帮助我识别代码中缺少检查(这种无效行为)的位置。

相关文章:

  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-28
  • 2021-11-09
  • 2022-12-23
  • 2021-05-07
  • 2021-04-01
  • 2022-12-23
相关资源
相似解决方案