尝试打开连接时的连接超时

时间:2022-11-08 19:17:39

I'm getting this error:

我收到这个错误:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

超时已过期。操作完成之前经过的超时时间或服务器没有响应。

I know that most of the time this problem is fixed by adding the commandtimeout property of a sqlcommand.

我知道大多数时候通过添加sqlcommand的commandtimeout属性来解决此问题。

The problem is that I'm getting this error trying to do this:

问题是我在尝试这样做时遇到此错误:

Dim con as new SqlConnection("connstring")

昏暗的con作为新的SqlConnection(“connstring”)

con.open() ' bang!, i'm getting the error here.

con.open()'砰!,我在这里得到错误。

The strange thing is that i'm getting the error when trying to open the connection, and the problem is intermitent, i mean I'm not getting this error always.

奇怪的是,我在尝试打开连接时遇到错误,问题是间歇性的,我的意思是我总是没有得到这个错误。

Any thoughts on how to solve this?, or what can be causing the error?

有关如何解决这个问题的任何想法,或者可能导致错误的原因是什么?

2 个解决方案

#1


Is it possible you've maxed out connections to it? Are you closing all the connections you're opening?

你有可能最大限度地与它建立联系吗?你关闭了你正在打开的所有连接吗?

#2


Have you looked at the Event logs on both boxes (Assuming you are running seperate)? I would double check what connections are open even if i was using a DAL using sp_who2 or similar.

你看过两个盒子上的事件日志(假设你正在单独运行)吗?我会仔细检查哪些连接是打开的,即使我使用sp_who2或类似的DAL。

Otherwise maybe a dodgy network which wont be so easy to debug, you should see signs in the event logs of this.

否则可能是一个不太容易调试的狡猾网络,你应该在事件日志中看到这个标志。

Does increasing the connection timeout help? This is not a solution but may help you debug.

增加连接超时有帮助吗?这不是解决方案,但可以帮助您进行调试。

#1


Is it possible you've maxed out connections to it? Are you closing all the connections you're opening?

你有可能最大限度地与它建立联系吗?你关闭了你正在打开的所有连接吗?

#2


Have you looked at the Event logs on both boxes (Assuming you are running seperate)? I would double check what connections are open even if i was using a DAL using sp_who2 or similar.

你看过两个盒子上的事件日志(假设你正在单独运行)吗?我会仔细检查哪些连接是打开的,即使我使用sp_who2或类似的DAL。

Otherwise maybe a dodgy network which wont be so easy to debug, you should see signs in the event logs of this.

否则可能是一个不太容易调试的狡猾网络,你应该在事件日志中看到这个标志。

Does increasing the connection timeout help? This is not a solution but may help you debug.

增加连接超时有帮助吗?这不是解决方案,但可以帮助您进行调试。