J
Jeff Greenland
Hello everyone,
I am having problems with Timers in a web application. They just seem to
stop running after 15 minutes or so.
My web application is set up like this:
When a user hits a page in the site, that page (.aspx) instantiates a
compiled class (.DLL). The instantiation process creates a Timer that runs
in the background to perform tasks every so often (such as notifying clients
every 24 hours if something is overdue, etc.).
The problem seems to be that if the site goes idle, the timer just dies
after awhile. I've searched high and low to find a solution for this, but
can't seem to find any answers. I have checked the processModel of my
machine.config and all of the timeout settings are "Infinite".
So, just for fun, I built one of my timers to run every minute and log some
text to a file. That way I could tell when it is aborting. I start up the
application and it prints a line every minute in the log, so I decide to go
to bed. I look at it in the morning to see that it stopped after 18 lines
in the log. I probably used the site for about 3 minutes before going to
bed, so I'm assuming this is a 15 minute timeout.
Nothing in the timer code tells them to abort or reschedule or anything.
The only line of code for this timer is to print the line to the log.
The only solution I have found that works is to use the scheduler (this is a
Windows 2000 server, by the way) in the control panel. I have created a
scheduled task to run every 10 minutes that will open Internet Explorer and
hit my web site, therefore keeping it active (or starting it back up if it
went idle).
It seems like there should be a way to keep the timers persistent for an
infinite amount of time. Could it be the garbage collector destroying an
object reference? Is it just the web application shutting down?
Oh, and as another note, the web application doesn't *seem* to be shutting
down entirely if it is shutting down. I have my system set up so that when
the first instantiation occurs, a few logs are printed out. That way I can
see what's happening when the application starts. Every time I change
web.config or recompile my DLLs, the application restarts (as it should) and
I see the new logs. However, when I leave my application running overnight,
then come in in the morning, the application has not shut down because no
"startup messages" are appearing in my logs. Yet the timers are dying
still.
Sorry about the long-winded question, but I thought I needed to provide a
good amount of information.
I greatly appreciate any help someone can provide. Thank you in advance for
looking at this.
Hegg
(wasn't sure which NG to post in, so I posted it in 2 of them)
I am having problems with Timers in a web application. They just seem to
stop running after 15 minutes or so.
My web application is set up like this:
When a user hits a page in the site, that page (.aspx) instantiates a
compiled class (.DLL). The instantiation process creates a Timer that runs
in the background to perform tasks every so often (such as notifying clients
every 24 hours if something is overdue, etc.).
The problem seems to be that if the site goes idle, the timer just dies
after awhile. I've searched high and low to find a solution for this, but
can't seem to find any answers. I have checked the processModel of my
machine.config and all of the timeout settings are "Infinite".
So, just for fun, I built one of my timers to run every minute and log some
text to a file. That way I could tell when it is aborting. I start up the
application and it prints a line every minute in the log, so I decide to go
to bed. I look at it in the morning to see that it stopped after 18 lines
in the log. I probably used the site for about 3 minutes before going to
bed, so I'm assuming this is a 15 minute timeout.
Nothing in the timer code tells them to abort or reschedule or anything.
The only line of code for this timer is to print the line to the log.
The only solution I have found that works is to use the scheduler (this is a
Windows 2000 server, by the way) in the control panel. I have created a
scheduled task to run every 10 minutes that will open Internet Explorer and
hit my web site, therefore keeping it active (or starting it back up if it
went idle).
It seems like there should be a way to keep the timers persistent for an
infinite amount of time. Could it be the garbage collector destroying an
object reference? Is it just the web application shutting down?
Oh, and as another note, the web application doesn't *seem* to be shutting
down entirely if it is shutting down. I have my system set up so that when
the first instantiation occurs, a few logs are printed out. That way I can
see what's happening when the application starts. Every time I change
web.config or recompile my DLLs, the application restarts (as it should) and
I see the new logs. However, when I leave my application running overnight,
then come in in the morning, the application has not shut down because no
"startup messages" are appearing in my logs. Yet the timers are dying
still.
Sorry about the long-winded question, but I thought I needed to provide a
good amount of information.
I greatly appreciate any help someone can provide. Thank you in advance for
looking at this.
Hegg
(wasn't sure which NG to post in, so I posted it in 2 of them)