Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

偶发报错:This MySqlConnection is already in use. #315

Open
BeStart opened this issue May 8, 2023 · 5 comments
Open

偶发报错:This MySqlConnection is already in use. #315

BeStart opened this issue May 8, 2023 · 5 comments

Comments

@BeStart
Copy link

BeStart commented May 8, 2023

System.InvalidOperationException
HResult=0x80131509
Message=This MySqlConnection is already in use. See https://fl.vu/mysql-conn-reuse
Source=MySqlConnector
StackTrace:
在 MySqlConnector.Core.ServerSession.StartQuerying(ICancellableCommand command)
在 MySqlConnector.Core.CommandExecutor.d__0.MoveNext()
在 MySqlConnector.MySqlCommand.d__79.MoveNext()
在 MySqlConnector.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
在 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
在 Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.InitializeReader(Enumerator enumerator) 在 Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) 在 Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.MoveNext()
在 System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Boolean& found) 在 System.Linq.Queryable.Count[TSource](IQueryable1 source)
在 VOL.Core.BaseProvider.RepositoryBase1.IQueryablePage(IQueryable1 queryable, Int32 pageIndex, Int32 pagesize, Int32& rowcount, Dictionary2 orderBy, Boolean returnRowCount) 在 D:\Project\Vue.NetCore\.Net6版本\VOL.Core\BaseProvider\RepositoryBase.cs 中: 第 266 行 在 VOL.Core.BaseProvider.ServiceBase2.GetPageData(PageDataOptions options) 在 D:\Project\Vue.NetCore.Net6版本\VOL.Core\BaseProvider\ServiceBase.cs 中: 第 321 行
在 VOL.System.Services.Sys_DictionaryService.GetPageData(PageDataOptions pageData) 在 D:\Project\Vue.NetCore.Net6版本\VOL.System\Services\System\Partial\Sys_DictionaryService.cs 中: 第 175 行

在调试下拉框绑定设置页面查询功能时,一开始输入字典编号49报了以上错误。
删除字典编号文本框的值重新查询后正常,后续输入字典编号49也未再出现报错。
请问这是哪里出现了异常,谢谢!

@cq-panda
Copy link
Owner

cq-panda commented May 8, 2023 via email

@cq-panda
Copy link
Owner

这个是页面查询,你调试的时候做了什么操作?

@thkings
Copy link

thkings commented May 10, 2023

这个应该是.Net Core的错误。调试时间过久

@BeStart
Copy link
Author

BeStart commented May 11, 2023

这个是页面查询,你调试的时候做了什么操作?
当时我就调试拿到查询sql,去数据库查询是否有数据。可能确实调试时间过久
https://www.cnblogs.com/ricolee/p/This-MySqlConnection-is-already-in-use.html
看了这个链接应该是查询代码中加tolist()让lazyloading及时执行就可以避免这种情况

@BeStart
Copy link
Author

BeStart commented May 11, 2023

这个应该是.Net Core的错误。调试时间过久

是的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants