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/