Reputation: 1256
I have a web app which has been added as a reference to my window service app. The service will call a method in the web app which then will invoke the database to run a stored procedure.
I received an exception while calling one of my stored procedure. The stored procedure will run for approximately 45 seconds.
This is the error I get:
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
I have tried to increase the service app timeout by appending ;Connection Timeout=3600
to the service app conn string in web.config
but the exception still occurred after around 30 seconds of running.
Your help to resolve this issue will be greatly appreciated.
Upvotes: 0
Views: 1032
Reputation: 1311
To elaborate on @Squirrel comment:
Your error message shows a System.Data.SqlClient.SqlException
. So the timeout is on SQL Server side.
So if you want to increase the timeout, it must be done on the SQL Server side.
In the System.Data.SqlClient
namespace you seem to use, the SqlCommand
class that you probably use to call your stored procedure has a property CommandTimeout
that let you set the timeout value.
See the documentation
CommandTimeout
Gets or sets the wait time (in seconds) before terminating the attempt to execute a command and generating an error.
Upvotes: 2