Connection timeout for SQL server(SQL 服务器的连接超时)
问题描述
是否可以通过修改web.config
中的连接字符串来增加超时时间?
Can I increase the timeout by modifying the connection string in the web.config
?
推荐答案
是的,您可以将 ;Connection Timeout=30
附加到您的 连接字符串并指定你想要的值.
Yes, you could append ;Connection Timeout=30
to your connection string and specify the value you wish.
Connection Timeout
属性中设置的超时值是以秒表示的时间.如果未设置此属性,则连接的超时值为默认值(15 秒).
The timeout value set in the Connection Timeout
property is a time expressed in seconds. If this property isn't set, the timeout value for the connection is the default value (15 seconds).
此外,将超时值设置为 0
,您指定您的连接尝试等待无限时间.如文档中所述,这是您不应该在连接字符串中设置的内容:
Moreover, setting the timeout value to 0
, you are specifying that your attempt to connect waits an infinite time. As described in the documentation, this is something that you shouldn't set in your connection string:
0 表示没有限制,应该避免ConnectionString,因为连接尝试会无限期地等待.
A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect waits indefinitely.
这篇关于SQL 服务器的连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL 服务器的连接超时


基础教程推荐
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01