|
Subject:
|
how to increase timeout on aspx page?
|
|
Posted By:
|
funtent
|
Post Date:
|
12/11/2003 6:49:33 PM
|
C# page gets data from a stored procedure. The procedure itself takes over 45 seconds and does not time out when run in Query Analyzer, but the page times out after ~30 seconds.
Session is set to 20 minutes.
So how to increase timeout period on that page? Thanks.
Funtent
|
|
Reply By:
|
jacob
|
Reply Date:
|
12/12/2003 4:49:57 AM
|
I haven't got the right answer for you, but I know how to do it in Classic ASP, and it will perhaps help you. I do not think it is about your session; I think it is a Server.ScriptTimeout issue, since this would do the trick in ASP...<% Server.ScriptTimeout = 240 %> more info. I had a similar problem where I needed to check for dead links in my database; that is, running some requests on each link in the DB, but if too many links were present I would get a timeout.
Hope it helps.
Jacob.
|
|
Reply By:
|
planoie
|
Reply Date:
|
12/12/2003 10:31:22 AM
|
Yes, Jacob is correct here. It's the same in ASP.net:
HttpServerUtility.ScriptTimeout Property Gets and sets the request time-out in seconds.
[C#] public int ScriptTimeout {get; set;}
Peter ------------------------------------------------------ Work smarter, not harder.
|
|
Reply By:
|
cjo
|
Reply Date:
|
12/20/2003 12:23:15 AM
|
My understanding is that ADO.NET has a better way. In your connection string add another argument to increase the connection timeout (default is 15 seconds). For example:
server=(local)\NetSDK;database=Northwind;integrated security=true;connection timeout=60;
|
|
Reply By:
|
planoie
|
Reply Date:
|
12/20/2003 1:57:22 AM
|
Well, we are talking about two different things here.
One is setting the timeout of the ASPX page, the other is setting the timeout of the SQL connection.
Which do you want to set? If you have a very hefty query, you'll need to adjust both accordingly. There's little sense in increasing the DB connection timeout if the ASPX is going to dump before the DB does.
Peter ------------------------------------------------------ Work smarter, not harder.
|
|
Reply By:
|
rastaspace
|
Reply Date:
|
1/10/2004 9:55:58 AM
|
For a hefty query, which is the case here as well, (since the process takes more than 45 secs to complete), you should adjust the CommandTimeout within your command object. By adjusting the connection timeout you just state the allowed time in seconds that the process will wait before it quits trying to GET a valid connection to the database, but when you already have a valid connection to the DB, then you need time to EXECUTE your query properly.
Rastaspace
quote: Originally posted by planoie
Well, we are talking about two different things here.
One is setting the timeout of the ASPX page, the other is setting the timeout of the SQL connection.
Which do you want to set? If you have a very hefty query, you'll need to adjust both accordingly. There's little sense in increasing the DB connection timeout if the ASPX is going to dump before the DB does.
Peter ------------------------------------------------------ Work smarter, not harder.
|