Set application timeout to more than 3 minutes

D

dadocsis

I have a custom VB.net application that runs a query against an SQL
server that takes more than 3 minutes. Right now after 3 minutes it
times out. So far after doing my research I have changed the following:

in web.config:
<system.web>

<httpRuntime executionTimeout="1000" maxRequestLength="2000000"/>
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="600"/>

In the page itself:

Me.SqlConnection1.ConnectionString = "workstation id=OBANG;packet
size=4096;user id=sa;data source=OBANG;persist securi" & _
"ty info=False;initial catalog=YZA; Connect Timeout=600 "
Me.SqlSelectCommand1.CommandTimeout = 600


The page still times out after 3 min. Is there anything that I am
missing?

Thanks in advance.
 
J

Joe (MCAD)

dadocsis said:
I have a custom VB.net application that runs a query against an SQL
server that takes more than 3 minutes. Right now after 3 minutes it
times out. So far after doing my research I have changed the following:

in web.config:
<system.web>

<httpRuntime executionTimeout="1000" maxRequestLength="2000000"/>
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="600"/>

In the page itself:

Me.SqlConnection1.ConnectionString = "workstation id=OBANG;packet
size=4096;user id=sa;data source=OBANG;persist securi" & _
"ty info=False;initial catalog=YZA; Connect Timeout=600 "
Me.SqlSelectCommand1.CommandTimeout = 600


The page still times out after 3 min. Is there anything that I am
missing?

Thanks in advance.
If memory serves me right, there is a connection timeout setting in
mssql thats in seconds; What is yours set to?

Joe (MCAD)
 
W

Walter Wang [MSFT]

Hi,

Would you please post the detailed exception when the page times out? Try
to visit it on localhost so that you can see the detailed exception.

I think this might not be related to the sql query's time out settings.
Anyway, let's see the exception first.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

dadocsis

Sorry it took me so long to write back. Yesterday was hectic.

I didnt mention that I already set the SQL server query timeout to 600
sec.

Here is the detailed exception:

Server Error in '/YZA_Remote' Application.
--------------------------------------------------------------------------------

Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the
server is not responding.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.


Stack Trace:


[SqlException: Timeout expired. The timeout period elapsed prior to
completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior) +45

System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
YZA_Remote.OrderControl.InitGridData() +8219
YZA_Remote.OrderControl.btnFetchNewData_Click(Object sender,
EventArgs e) +49
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1273
 
W

Walter Wang [MSFT]

Hi,

Hope you're better now.

For page execution time out setting, it's only effective in Release mode:

#httpRuntime Element (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/library/e1f13641.aspx
executionTimeout Optional TimeSpan attribute.

Specifies the maximum number of seconds that a request is allowed to
execute before being automatically shut down by ASP.NET.

This time-out applies only if the debug attribute in the compilation
element is False. To help to prevent shutting down the application while
you are debugging, do not set this time-out to a large value.

The default is "00:01:50" (110 seconds).Note

In the .NET Framework 1.0 and 1.1, the default is 90.
#############


From the exception and stack trace, it seems related to ADO.NET query timed
out. To confirm this issue is not related to ASP.NET, try to issue the
query in a WinForm or Console application. Normally you only need to set
the connection time out in the connection string and you set the command
time out in CommandTimeOut property. This should work as expected. Anyway,
let's first narrow down the issue to see if it's related to ASP.NET or not.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

I suggest create a simple Console application and use the same database
access code in your web application to test it, this way we could know if
it's related to ASP.NET or not.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

dadocsis

Walter said:
I suggest create a simple Console application and use the same database
access code in your web application to test it, this way we could know if
it's related to ASP.NET or not.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Walter Sorry for the delayed response again. I am going to have to hold
off on this for a little while. I am not a programmer I just have a
little light programming experience with VB based languages. The
program was initially created by an experienced coder and due to $ my
company doesnt want to hire him again to fix this problem so this is
why I am stuck with it. The query comes from a complex stored
proceedure that is like 10 pages long! It will take me some time to
build a Console app. so I will have to hold off on this when I am not
so busy. Thanks for your time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top