连接超时对于SQL Server [英] Connection timeout for SQL server
问题描述
我可以增加超时通过修改 web.config中的连接字符串
?
Can I increase the timeout by modifying the connection string in the web.config
?
推荐答案
是的,你可以追加;连接超时= 30
您的<一个href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx">connection字符串并指定希望的值。
Yes, you could append ;Connection Timeout=30
to your connection string and specify the value you wish.
在连接设置的超时值超时
属性是时间前$ P pssed以秒为单位$ 。如果这个属性没有设置,用于连接的超时值是默认值(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 Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!