473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

CommandTimeout, ConnectionTimeout, httpRuntime executionTimeout (ASP.NET 2.0)

Hi all.

I would like to know what is the difference between these two timeouts:

- CommandTimeout
- ConnectionTimeout
I have following setting in my web.config file:
<httpRuntime executionTimeout="60"/>
Which timeout does it set (command, connection or other)?
Is it possible to globally set CommandTimeout e.g. in web.config?
And last thing: in my app. I get this exception:
System.Web.HttpUnhandledException: Exception of
type 'System.Web.HttpUnhandledException' was thrown. --->
System.Reflection.TargetInvocationException: Exception has been thrown
by the
target of an invocation. ---> System.Data.SqlClient.SqlException:
Timeout
expired. The timeout period elapsed prior to completion of the
operation or
the server is not responding.
What should I do to fix it? I think that I should set CommandTimeout to

some bigger value, but I would like to make it only in one place, not
in every SqlCommand I have.
Is it possible?
Thanks in advance,
Piotrek

Apr 4 '06 #1
3 22986
ConnectionTimeout specifies how long, in seconds, should the code wait
before timing out from trying to OPEN a connection. It relates directly to
the line connection.Oen();

CommandTimeout specified how long, in seconds, should the command wait
before timing out. This relates to calls such as Fill(), ExecuteXXX (Reader,
Scalar, NoQuery) and such. It's relelated to the actual SQL code you are
trying to run (be it inline or an sproc).

the HttpRuntime is how long a request should wait before timing out. This is
much broader than the first two. You can think of it as anything between
your page's init and unload.

CommandTimeout would seem to be your problem. You can't globally set it like
the other two. But you can create a utlity function, so that the code is
centralized.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Piotrek" <pt*********@poczta.fm> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi all.

I would like to know what is the difference between these two timeouts:

- CommandTimeout
- ConnectionTimeout
I have following setting in my web.config file:
<httpRuntime executionTimeout="60"/>
Which timeout does it set (command, connection or other)?
Is it possible to globally set CommandTimeout e.g. in web.config?
And last thing: in my app. I get this exception:
System.Web.HttpUnhandledException: Exception of
type 'System.Web.HttpUnhandledException' was thrown. --->
System.Reflection.TargetInvocationException: Exception has been thrown
by the
target of an invocation. ---> System.Data.SqlClient.SqlException:
Timeout
expired. The timeout period elapsed prior to completion of the
operation or
the server is not responding.
What should I do to fix it? I think that I should set CommandTimeout to

some bigger value, but I would like to make it only in one place, not
in every SqlCommand I have.
Is it possible?
Thanks in advance,
Piotrek

Apr 4 '06 #2
Thanks Karl.

It's a pity that CommandTimeout cannot be globally set. I think I will
create some Session variable and store there value of command timeout
and then assing it to every SqlCommand I have.

One more question: do you know how can I set commandTimeout to fill
method of some TableAdapter, which was created using DataSet Designer?
I am asking, because I cannot find this property.

Best regards,
Piotrek

Apr 5 '06 #3
No, I don't off the top of my head.

Also,not sure why you'd store this in the session, why not just do:

internal shared SqlCommand GetSqlCommand()
{
SqlCommand command = new SqlCommand();
command.CommandTimeout =
ConfigurationSettings.ApSettings["commandTimeout"];
return command;
}

or something..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Piotrek" <pt*********@poczta.fm> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
Thanks Karl.

It's a pity that CommandTimeout cannot be globally set. I think I will
create some Session variable and store there value of command timeout
and then assing it to every SqlCommand I have.

One more question: do you know how can I set commandTimeout to fill
method of some TableAdapter, which was created using DataSet Designer?
I am asking, because I cannot find this property.

Best regards,
Piotrek

Apr 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim Meagher | last post by:
I am running ASP code that was migrated from a Windows 2000 Server to a Windows 2003 server. For some reason the connection timeout or command timeout are getting ignored and my query time sout...
2
by: Grey | last post by:
I have developed an ASP.NET application for my user. When the user left the application for a while (still open in the IE), and then go back the application. He found that some buttons to start some...
0
by: Virag Gutgutia | last post by:
Hi, I am trying to understand the behaviour of executionTimeout attribute in the httpRuntime element. From what I understood in the documentation that by setting the executionTimeout i can limit...
0
by: Peter Jaffe | last post by:
I had noticed a number of people posting that they where having trouble getting the Web.config httpRuntime executionTimeout attribute to work as expected. I realized today that if the...
15
by: Asshen Shugar | last post by:
Hey. I was experimenting with file uploading possibility using ASP.NET. I ran into a problem :( I can upload small files, but if I try a bigger file it doesn't work... Anyone who can help...
10
by: Jim Underwood | last post by:
I am having a problem with my web page timng out while retrieving a long runnign report (90-120 seconds. I have tried modifying several settings in various places and cannot get it to run for more...
1
by: dejavue82 | last post by:
Hi, What is the maximum value I can set to the following web.config property to? <httpRuntime executionTimeout=""> I'm asking, since I'm not sure if there is a setting on my host's shared...
0
by: andersboth | last post by:
If in web.config i set httpRuntime executionTimeout="00:00:05". Then i would like to be able to catch and event in global.asax.cs, when a timeout happen. Or at least se it logged on the server in...
0
by: R3al1ty | last post by:
ExhibitA: protected void Page_Load(object sender, EventArgs e) { Thread.Sleep(100000); } ExhibitB: protected void Page_Load(object sender, EventArgs e)
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.