zoukankan      html  css  js  c++  java
  • MySql.Data.MySqlClient.MySqlProtocolException:“Packet received out-of-order. Expected 1; got 2.”

    环境为:

    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或代码示例,那将是很好的,因为它可以帮助我识别代码中缺少检查(这种无效行为)的位置。

  • 相关阅读:
    django全文搜索学习心得(一)haystack 篇
    django request get_full_path 中文问题
    django全文搜索学习心得(五) whoosh 精简版
    django全文搜索学习心得(二)solr 篇
    django全文搜索学习心得(四)sphinx篇
    模拟队列
    差分
    模拟栈
    区间合并
    离散化
  • 原文地址:https://www.cnblogs.com/OnlyDreams/p/12157199.html
Copyright © 2011-2022 走看看