How long can my asp.net application run for?

G

Guest

I'm pretty new to asp.net and am having problems with my application timing
out.

I've written an application that loops through all of the information on an
excel spreadsheet and does certain things with it, like creating and
configuring WSS sites.

My application runs fine for approximately 25 minutes, then I get the 'Page
cannot be displayed' error. It seems like my browser times out before the
application can finish what its doing.

What settings should I be checking? Are there asp.net settings I need to
configure, or is my browser the culprit (does it think the page is never
going to load and just time out)?

Thanks for any help!

- Chase
 
S

Steve C. Orr [MVP, MCSD]

Web pages were never really designed to run for so long.
I'd suggest you have a windows service execute the functionality
asynchronously.
When it finishes, it can set a flag and the user can check back every so
often to see the status.
You could set a page that automatically refreshes every so often to display
an ongoing status report.

Here's more info on Windows Services:
http://msdn.microsoft.com/library/d.../vbconintroductiontontserviceapplications.asp
 
G

Guest

Thanks for the suggestion!

In my web.config for my Visual Studio project I modified the timout
attribute as follows:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="240"
/>

Also, in IIS Manager I right clicked on the folder in which my application
lives, went to properties, on the Directory tab I clicked on the
Configuration button, went to the options tab and changed the Session timeout
from the default 20 to 240.

Rebuilt my application, restarted IIS and ran my application again. I still
didn't make it past the ~25 min mark, and got the same page cannot be
displayed error.

In an attempt to troubleshoot what might be causing the problem I added code
in my global.asax.cs to write a text file with the system time in it for the
following events:
Application_Start
Session_Start
Session_End
Application_End

After running the application, only one file was written: Application_Start
(which leads me to believe the session_start/end and application_end events
never occured).

Any other ideas?

Thanks all for your time!

- Chase
 
J

Juan T. Llibre

Hi, Chase.

Your application could be recycling at 25 minutes due to other settings.

Check your Application Pool's recyclying settings.
( IIS Manager, scroll on the left to Application Pools,
and right click --> select "Properties". )

Look for any short time periods in the recycling tab.

Try this to check whether the Session_OnStart
and Application_OnStart events are firing:

In global.asax, in Application_OnStart ( you can also use Application_Start )

Application("APP_START_TIME") = DateTime.Now

And, in global.asax, in Session_OnStart ( you can also use Session_Start )

Session.Contents("AppStartTime") = Now

Then, in your test page, use :

Sub Page_Load(Sender As System.Object, E As System.EventArgs)
Label1.Text = "The application's start time was : " & Application("APP_START_TIME")
Label2.Text = "The session's start time was : " & Session("AppStartTime")
End Sub

And, in the body of your test page :

<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server"></asp:Label><br />
<asp:Label ID="Label2" Runat="server"></asp:Label><br />
</div>
</form>

Let us know whether both events are reported.



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
G

Guest

Good Morning Juan, Thanks for the suggestions!

I added code as you suggested below to my project. When I navigated to my
page with the application on it I received the following error:
"Session state can only be used when enableSessionState is set to true,
either in a configuration file or in the Page directive "

Which leads me to believe... that the session state is not what is holding
me up at 20 minutes.

I also checked the application pool recycle settings as you suggested. The
only setting that is checked is 'Recycle worker processes at the following
times: 01:48'

Any other suggestions are greatly appreciated!
Thanks for your time!

- Chase
 
G

Guomao Xin

In IIS, right-click the "Default Web Sites" tree item, in the "Web
Site" tab, set the "Connection timeout" to your expected time( 25 mins
e.g.).
Hope it can work.
Thanks.

-Guomao
 

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

Top