MySql.Data.MySqlClient.MySqlException:超时已过期
最近,我的网络应用程序中的一个特定页面抛出了
异常详细信息:MySql.Data.MySqlClient.MySqlException:超时 已到期。超时时间在完成之前已过 操作或服务器没有响应。
虽然我使用Ibtais作为持久层,但还是出现这个错误。我已经重新启动了 MySql 服务实例,但仍然遇到相同的错误。这种情况不是以前发生过,而是最近经常发生。
服务器上部署的所有Web应用程序都使用Ibatis,并且DB服务器保留在安装IIS的同一台计算机上。大约有 8000 条记录,其中大约 300 到 500 条记录会在页面加载时被过滤
对于问题原因有什么见解吗?
In recent times, a particular page in my web app throws the
Exception Details: MySql.Data.MySqlClient.MySqlException: Timeout
expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
Though I use Ibtais as persistence layer, this error occurs. I have restarted the MySql service instance but stil i get the same error. It didn't happen earlier but happens frequently in recent times.
All the web applications deployed on the server uses Ibatis and the DB server remains on the same machine where IIS is installed. There are about 8000 records in which around 300 to 500 would be filtered on page load
Any insights for the cause of the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了和你一样的问题,我发现这个 MySQLConnection--Specifying default命令超时。
只需将“默认命令超时=xxx”添加到您的 connectString 中,该键的值以秒为单位。
我尝试过,它对我有用。
I encountered the same problem with yours, and I found this MySQLConnection--Specifying default command timeout.
Just add "default command timeout=xxx" into your connectString, this key's value is in seconds.
I tried and it worked for me.
您可以将命令超时设置为 0,但这不是一个好主意。有些请求可能会无限期地持续下去。
首先存在一个导致查询超时的根本问题。您是否正在插入、更新或以任何方式处理会锁定表的大型二进制值?这是我在如此少量的数据上看到的此类错误的最常见原因。
You could set command timeout to 0, its not a good idea though. Some requests could go on indefinitely.
There is an underlying problem that is causing the queries to time out in the first place. Are you inserting, updating, or in any way working with large binary values that would lock the table? That is the most common reason I see for an error like this on such a small amount of data.
使您的连接字符串如下所示:
DotNet Framework:
DotNet Core
Make your connection string look like this:
DotNet Framework:
DotNet Core