c# - fatal error 导致超时 -mysql

标签 c# asp.net mysql

MySql.Data.MySqlClient.MySqlException: Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) --- End of inner exception stack trace

这个错误是什么意思?我的连接字符串中有最大连接池=200?我的应用程序是 .net 中连接 mysql 数据库的 Web 应用程序。

最佳答案

连接池并不能解决这个问题。连接池允许与服务器建立多个连接,然后回收以避免重新建立连接。建立和重新建立连接可能会耗费大量时间和计算资源。

您正在寻找的是增加命令超时。这可以通过两种方式之一完成。在连接字符串中指定 default command timeout或通过将值分配给 CommandTimeout MySqlCommand 上的属性。

关于c# - fatal error 导致超时 -mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6554303/

相关文章:

c# - 在 Sql Server 2008 中获取 Guid.getHashCode() 的等效值

c# - 具有从非泛型基类继承的泛型类的 MongoDB C# 驱动程序类型鉴别器

c# - 如何控制使用 AutoDual 生成的 COM 接口(interface)的生成接口(interface) GUID

html - 仅带有 Image Css 的水平菜单

c# - Web Api - 同时执行几个请求时响应真的很慢

mysql - 如何在 MySQL 中进行行版本控制,同时保持外键引用完整性

php - 选择不等于多个指定 ID 的数据

mysql - MySql 上的大 ibdata1 文件会影响数据库性能吗?

c# - 如何使用 Array.sort 按特定元素对结构数组进行排序

asp.net - 如何在 ASP.NET Core 1.0 应用程序中使用 SqlServer.Types/空间类型