Hi Experts,
I have a windows service running every minute and has many database operations to perform.
It runs perfectly for many days, sometimes it suddenly stops and throws this exception. Later when we start to debug it, the exceptions goes off, but if we don't debug, the exception continues to come. We are tired of this totally random scenario. Please assist us with this.
We are using sqlhelper.cs for database interaction.
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
Best Regards,
Wajid Ahmed Ansari.
Loading

Suthish NairRank #92 · 22.8K reputationPosted Feb 2, 2011, 11:46 PM EST
You need to increase the value for Connection TimeOut property.Ther are two types of timeout exception that could be raised by SqlClientobjects: SqlConnection and SqlCommand. Browse and check which one needs to update for your problem.
Suthish NairRank #92 · 22.8K reputationPosted Feb 2, 2011, 11:49 PM EST
2. SQLCommand Connection Timeout.
wajid ansari47 reputationPosted Feb 2, 2011, 11:54 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Feb 3, 2011, 12:23 AM EST
wajid ansari47 reputationPosted Feb 3, 2011, 1:45 AM EST
The service is calling DB very frequently. Since three hours the service is responding well and no sign of DB overloads. Also it had been on for 20 days without rest and everything was well.
I will post the message if i get this exception again, i already cleared my logs before.
The additional insight into the problem is every method going to DB suffers the same exception. Like simple update statement running within a second now takes more than 30 seconds when this problem comes up.
So i got curious as whats the main issue.
Hope this helps to get hold of problem.
Suthish NairRank #92 · 22.8K reputationPosted Feb 3, 2011, 7:48 AM EST
check your timeout value and try increasing.
Suthish NairRank #92 · 22.8K reputationPosted Feb 4, 2011, 9:29 AM EST
Sam HobbsRank #108 · 20.5K reputationPosted Feb 4, 2011, 1:50 PM EST
I am not familiar with SQL Server enough to help you with the following, but perhaps you can add code to determine if the dataabase is available and if it is then lock it so other maintenance will wait. I am sorry that I can't help with that though.
You could add code to your exception processing so that the service can wait a while and then try again.