A second operation was started on this context before a previous operation completed

解决异常情况,并发情况会导致异常,每次创建一个新上下文就解决了
InvalidOperationException: A second operation was started on this context before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913.
Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.EnterCriticalSection()
在上一个操作完成之前,在此上下文上启动了第二个操作。 这通常是由不同线程同时使用同一个 DbContext 实例引起的。
有关如何避免 DbContext 线程问题的详细信息,请参阅 https://go.microsoft.com/fwlink/?linkid=2097913。

参考代码:

   public async Task<int> 

你可能感兴趣的:(EF,Core,精华篇,c#,http,开发语言)