2

Logging:System.Data.SqlClient.SqlException: Timeout expired. 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. 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. But still the exception is keep coming.

can anyone suggest me any solution so i can get rid of the above problem thanks

4
  • How did you set the timeout. There are different kinds of sql timeouts you can set. Commented Aug 6, 2012 at 0:17
  • i have set out in the web.config Commented Aug 6, 2012 at 0:20
  • 1
    What happens when you step through the debugger and hit F10 on that line of code? Does it complete in five seconds? Typically, if your queries take that long, you'll want to make them more efficient rather than increasing the timeout. Commented Aug 6, 2012 at 1:41
  • Check this Link stackoverflow.com/a/9193788/1142987 Commented Aug 6, 2012 at 9:30

1 Answer 1

2

The setting in the web config, if it's the timeout in the connection string setting, is the connection timeout. 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.

http://msdn.microsoft.com/en-us/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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.