Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during t
Then add it in the connection string:
server={servername};database={dbname};uid={username};pwd={password};Connect Timeout=600
Perhaps this doesn't apply, but I think it should be mentioned none the less. The default CommandTimeOut is 30 seconds. This should be plenty of time for any actions that are happening in 99.9% of a web application. Unless you are absolutely sure that the action should take longer than that, you should spend your time trying to optimize the sql so that it returns in <30 seconds. Proper indexing is a good place to start for that.
+1 to Al because 30 seconds should be plenty. Making the timeout period longer is really only a bandage to the underlying problem.
In my experience the stored proc is too expensive 90% of the time. When I was reviewing these errors last, I had a general rule of thumb that no stored proc cost more than 1.00. The more expensive they are, the greater the risk we had of blocking and generating these exceptions.
the used query wasn't optimized for the amount of data. In our case we have purged unused data, but an better option should be optimizing the query or to have a look at the housekeeping. After the action we didn't receive the error anymore. Ofcourse it depends on the situation in which you receive this error and if this solution will help you out.
You can accomplish this by adding "Connect Timeout=90" to the connection string. If your query is taking longer than 30 seconds though you should really consider optimizing the query somehow. Indexes may need to be added or a view might need to be created, etc.
Edited to correct issue pointed out by @Stijn comments.
You can raise the timeout period on the command by setting the SqlCommand.CommandTimeout property.