SQL 等待操作超时。ASP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39176692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:49:33  来源:igfitidea点击:

The wait operation timed out. ASP

sqlasp.netconnection

提问by Vic

I created an internal website for our company. It run smoothly for several months and then I made a major update due to user suggestion. When I run in live, it run normally. Then suddenly one of my user from japan sending me an "The Wait operation timed out." error. When I check access that certain link, It run normally for me and some other who I ask to check if they access that page. I already update the httpRuntime executionTimeout but still no luck. Is it the error come from database connection? If I increase the timeout in the database connection it will be fix the problem?

我为我们公司创建了一个内部网站。它顺利运行了几个月,然后我根据用户的建议进行了重大更新。当我在 live 中运行时,它运行正常。然后突然我的一位日本用户向我发送了“等待操作超时”。错误。当我检查访问该特定链接时,它会为我和我要求检查他们是否访问该页面的其他一些人正常运行。我已经更新了 httpRuntime executionTimeout 但仍然没有运气。错误是否来自数据库连接?如果我增加数据库连接的超时时间,它会解决问题吗?

采纳答案by John Wu

If you found the exact error "The wait operation timed out" then it is likely you have a database call that took longer than expected. This could be due to any number of things:

如果您发现确切的错误“等待操作超时”,那么您的数据库调用时间可能比预期的要长。这可能是由于多种原因:

  1. Transient network problem
  2. High SQL server load
  3. Problem with SAN, RAID, or storage device
  4. Deadlock or other form of multiprocess contention
  1. 瞬态网络问题
  2. 高 SQL 服务器负载
  3. SAN、RAID 或存储设备出现问题
  4. 死锁或其他形式的多进程争用

You haven't shared enough information to troubleshoot. The way I would manage this would be to check for other occurrences of the problem and see if there is a pattern, e.g. if the problem occurs at a certain time of day.

您分享的信息不足,无法进行故障排除。我处理这个问题的方法是检查问题的其他发生情况并查看是否存在模式,例如问题是否发生在一天中的某个时间。

Certainly increasing the timeout is not a bad idea (if it is currently set pretty low) and may resolve the problem in and of itself.

当然增加超时不是一个坏主意(如果它当前设置得非常低)并且可能会解决问题本身。

回答by Shannon Holsinger

Remember to increase the connection timeout AND the command timeout:

请记住增加连接超时和命令超时:

SqlConnection(@"Data Source=SQLSERVER;Initial Catalog=MYCATALOG;Integrated Security=True;Connection Timeout=1000");//huge timeout

and then:

进而:

com.CommandTimeout = 950;//or whatever

回答by user728630

I fixed this error by finding the exact procedure in event viewer where timeout was happening.

我通过在发生超时的事件查看器中查找确切过程来修复此错误。

Connected to the same Database in SSMS and ran:

在 SSMS 中连接到同一个数据库并运行:

exec sp_recompile 'Procedure name'

It showed the below message:

它显示了以下消息:

Object 'Procedure name' was successfully marked for recompilation.

对象“过程名称”已成功标记为重新编译。

回答by CountLessQ

In the web.config file go to connections String and add this: ;Integrated Security=True;Connect Timeout=120"

在 web.config 文件中,转到连接字符串并添加以下内容:;Integrated Security=True;Connect Timeout=120"

回答by OlegI

It can also be another issue. For instance, if you run a lot of queries during one connection opened and it exceeds the connection lifetime. Then you need to set Connection Lifetimeproperty in your connection string. Here is the description:

这也可能是另一个问题。例如,如果您在打开一个连接期间运行大量查询,并且超过了连接生命周期。然后您需要Connection Lifetime在连接字符串中设置属性。这是描述:

When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online. A value of zero (0) causes pooled connections to have the maximum connection timeout.

当一个连接返回到池中时,它的创建时间将与当前时间进行比较,如果该时间跨度(以秒为单位)超过 Connection Lifetime 指定的值,则该连接将被销毁。这在集群配置中很有用,可以在正在运行的服务器和刚刚上线的服务器之间强制进行负载平衡。零 (0) 值会导致池连接具有最大连接超时。