While i am executing stored procedure via asp.net, application throws connect timeout expire
exception.
But if i execute stored procedure through query window it executes successfully in 46 seconds.
Do you have any idea about the problem?
While i am executing stored procedure via asp.net, application throws connect timeout expire
exception.
But if i execute stored procedure through query window it executes successfully in 46 seconds.
Do you have any idea about the problem?
You can set timeout value in the connection string, but to set timeout value for specific stored procedure to be executed, you can use the way suggested by @doterob
Check following links:
Edit:
You might want to check out why it takes so much time to execute the stored procedure.
The execution produces a timeout exception. You may change the timeout parameter
When you create de SqlCommand to execute stored procedure, you can put the timeout in seconds
SqlCommand command = new SqlCommand();
command.CommandTimeout = 100; //100 seconds
use this piece of code for checking How much time it is taking
SqlCommand cmd = new SqlCommand();
cmd.CommandTimeout = 100;(100 is in second)
by increasing CommandTimeout you can check.
It may be either your sql command execution times out
or your web server times out
. Since you said it takes 46 seconds in SSMS, I think it is your web server timing out. I would suggest you to increase both time out values to suitable values.
For IIS you could use IIS Manager to do that. Here is a good link for IIS 7.0