简体   繁体   English

sql超时过期

[英]sql timeout expired

Logging:System.Data.SqlClient.SqlException: Timeout expired. Logging:System.Data.SqlClient.SqlException:超时已过期。 The timeout period elapsed prior to completion of the operation or the server is not responding. 在操作完成之前超时或服务器没有响应。

i am a beginner when i saw in the application log files the above is the most frequent error i saw and also it is getting repeated everyday. 我是一个初学者,当我在应用程序日志文件中看到以上是我看到的最常见的错误,而且每天都在重复。 on the database when i saw time taken for executing the particular procedure which the above function is calling is less than 5 secs. 在数据库上,当我看到执行上述函数正在调用的特定过程所花费的时间少于5秒时。 But in the application we gave connection timeout=200s and by default command timeout=30 secs our manager says we don't have to increase the command timeout by anymore further as it is true. 但是在应用程序中,我们给了connection timeout=200s timeout=30 secs ,默认情况下命令timeout=30 secs我们的经理说我们不必再增加命令超时了,因为这是事实。 But still the exception is keep coming. 但是仍然有例外。

can anyone suggest me any solution so i can get rid of the above problem thanks 谁能建议我任何解决方案,以便我可以摆脱上述问题,谢谢

The setting in the web config, if it's the timeout in the connection string setting, is the connection timeout. Web配置中的设置(如果是连接字符串设置中的超时)是连接超时。 It only applies to the time it takes to make a connection. 它仅适用于建立连接所花费的时间。 From your problem description, it doesn't sound like a connection timeout is what's happening. 从您的问题描述中,听起来好像不是发生连接超时。

Command timeouts are specified in other ways. 命令超时以其他方式指定。 If you are using DataContext, for example, the timeout is set using the CommandTimeout property. 例如,如果使用的是DataContext,则使用CommandTimeout属性设置超时。

http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.commandtimeout.aspx http://msdn.microsoft.com/zh-CN/library/system.data.linq.datacontext.commandtimeout.aspx

If you can give a code snippet of how you are hitting the database so we can see what classes you are using, more specific recommendations can be made. 如果您可以提供有关如何访问数据库的代码段,以便我们可以看到正在使用的类,那么可以提出更具体的建议。

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

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