加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp-classic – ConnectionTimeout无效

发布时间:2020-12-16 10:02:12 所属栏目:asp.Net 来源:网络整理
导读:我尝试构建数据库故障转移(ASP经典)但我有设置问题:ConnectionTimeout. 我将其设置为1秒,但仍然服务器尝试连接到第一个连接超过20秒. 我喜欢连接将在1秒后丢失,所以我可以将用户转移到第二个连接. 谢谢, %DSN = "Provider=SQLOLEDB; Data Source=62.62.62.6
我尝试构建数据库故障转移(ASP经典)但我有设置问题:ConnectionTimeout.
我将其设置为1秒,但仍然服务器尝试连接到第一个连接超过20秒.
我喜欢连接将在1秒后丢失,所以我可以将用户转移到第二个连接.

谢谢,

<%
DSN             = "Provider=SQLOLEDB; Data Source=62.62.62.62; Initial Catalog=150109;User Id=noa; Password=tfdh545h54h;"
DSN1                = "Provider=SQLOLEDB; Data Source=127.0.0.1; Initial Catalog=150109;User Id=noa; Password=tfdh545h54h;"

Set conn            = Server.CreateObject("ADODB.Connection")
conn.ConnectionTimeout = 1
conn.CommandTimeout = 1
Set rs              = Server.CreateObject("ADODB.RecordSet")
On Error Resume Next
    conn.Open DSN
    If Err.Number <> 0 Then
        conn.Open DSN1
    End If
On Error Goto 0
'--

sql ="SELECT TOP 10 *"
sql = sql & " FROM allDB"
rs.Open sql,conn
if (not rs.eof) and (not rs.bof) then
    groupARRAY = rs.GetRows
end if
rs.Close

'--
conn.Close
Set rs          = Nothing
Set conn        = Nothing
%>

解决方法

我找到了与你的 here its link最相似的问题.请阅读它.它的片段就在这里.

‘minimum’ delay of 13 secs comes from the lower TCP/IP layers which retry any connection at least 3 times. This can only be modified in registry (TCP/IP protocol parameters)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读