简体   繁体   English

SQL Server连接超时

[英]Sql Server connection timeout

I'm trying to execute a sql server query through asp.net but the following exception occurs : "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding." 我试图通过asp.net执行sql服务器查询,但是发生以下异常: “执行超时已到期。在操作完成之前超时时间已过,否则服务器未响应。”

My connection string timeout is 300000 and remote query timeout in sql server is 60000 how can i solve this problem 我的连接字符串超时为300000,而SQL Server中的远程查询超时为60000,我该如何解决此问题?

I seems you have a blocked table. 我好像你的桌子被挡住了。 You can exec sp_lock to see who is blocking what. 您可以执行sp_lock来查看谁阻止了什么。

If there is no blocking, then you have a query really bad constructed. 如果没有阻塞,那么您的查询构造就很糟糕。

Please extend the script execution timeout in web.config file. 请延长web.config文件中的脚本执行超时。

<!-- Increase script execution timeout  -->
<system.web>
    <httpRuntime executionTimeout="300" /> <!-- its 5 min -->
</system.web>

Hope, this will resolve your issue. 希望这能解决您的问题。

Thanks, Rohit 谢谢罗希特

The problem is with the command timeout, i solved the problem with the following line of code : 问题是命令超时,我用下面的代码行解决了这个问题:

command.CommandTimeout = 30000;

but the question now : how can i set commandTimeout default value over the application 但是现在的问题是:如何在应用程序上设置commandTimeout默认值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM