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) 3 2036
With ASP.NET, the application dies once the last session has died. You can
modify the amount of time that a session will stay alive, but there is no
way to make it infinite. The class System.Web.Sess ionState.HttpSe ssionState
has an Int32 field called _timeout (accessed through the Timeout property)
which specifies the number of minutes that a session will stay alive, so you
could set this value to System.Int32.Ma xValue in order to keep it alive as
long as possible, but you can never keep it alive infinitely. Instead of
using ASP.NET to run this scheduled process, you should use a Windows
service that runs this as often as necessary.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--
"Jeff Greenland" <je************ **@netwidedev.c om> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl... 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)
Thanks Chris, I was actually able to find a solution by taking advice from
Alvin. Basically the simple solution is to create your timers via the
application_Sta rt() event in your application's "global.asa x" file.
Thanks for the reply, I appreciate it.
Jeff
"Chris Jackson" <chrisjATmvpsDO TorgNOSPAM> wrote in message
news:e1******** ******@TK2MSFTN GP10.phx.gbl... With ASP.NET, the application dies once the last session has died. You can modify the amount of time that a session will stay alive, but there is no way to make it infinite. The class
System.Web.Sess ionState.HttpSe ssionState has an Int32 field called _timeout (accessed through the Timeout property) which specifies the number of minutes that a session will stay alive, so
you could set this value to System.Int32.Ma xValue in order to keep it alive as long as possible, but you can never keep it alive infinitely. Instead of using ASP.NET to run this scheduled process, you should use a Windows service that runs this as often as necessary.
-- Chris Jackson Software Engineer Microsoft MVP - Windows Client Windows XP Associate Expert -- More people read the newsgroups than read my email. Reply to the newsgroup for a faster response. (Control-G using Outlook Express) --
"Jeff Greenland" <je************ **@netwidedev.c om> wrote in message news:eu******** ******@TK2MSFTN GP12.phx.gbl... 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)
Chris,
I believe his problem is related to the timer being on the page. If the
timer is moved to global.asax, it will fix the situation since the timer
becomes global to the application and not susceptible to session ends. The
advantage of this is the timer dies when the app gets recycled which is a
nicety. In the OP's post, the problem occurs when the page goes away, or
gets torn down or session ends, it takes the timer with it.
Actually I believe it is a bit more complicated than this. I believe the
timer, running as a background thread, eventually dies when the session end
event causes this thread to stop executing. Which is why it goes out after
roughly the session time out. Your solution, while it would work, would
still not be bullet proof because maxvalue is still a finite number.
I've put about 20 seconds of thought into this by the way so it may not be
spot on.
--
Regards,
Alvin Bruney
Got DotNet? Get it here http://home.networkip.net/dotnet/tidbits/default.htm
"Chris Jackson" <chrisjATmvpsDO TorgNOSPAM> wrote in message
news:e1******** ******@TK2MSFTN GP10.phx.gbl... With ASP.NET, the application dies once the last session has died. You can modify the amount of time that a session will stay alive, but there is no way to make it infinite. The class
System.Web.Sess ionState.HttpSe ssionState has an Int32 field called _timeout (accessed through the Timeout property) which specifies the number of minutes that a session will stay alive, so
you could set this value to System.Int32.Ma xValue in order to keep it alive as long as possible, but you can never keep it alive infinitely. Instead of using ASP.NET to run this scheduled process, you should use a Windows service that runs this as often as necessary.
-- Chris Jackson Software Engineer Microsoft MVP - Windows Client Windows XP Associate Expert -- More people read the newsgroups than read my email. Reply to the newsgroup for a faster response. (Control-G using Outlook Express) --
"Jeff Greenland" <je************ **@netwidedev.c om> wrote in message news:eu******** ******@TK2MSFTN GP12.phx.gbl... 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)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dmitry Demchuk |
last post by:
Hi everybody.
Recently I ran into situation with System.Threading.Timer in my ASP.NET
application. I reinstalled Windows on one of my servers and got timers stop
firing events after while, they just stop functioning one-by-one.
Here is detailed explanation. I run application on 2 dedicated Win 2003
servers. Server A serves about 1000 active simultaneous users (150-200 aspx
page requests per second), Sever B serves about 400 users (80-100...
|
by: johnny |
last post by:
In a multi-threaded application, say a worker thread makes an asynchronous
call and specifies a callback method. But before the callback is executed,
the thread is aborted by its creator. What is the expected behavior for
this scenario? Does the thread stay alive until the callback is executed? If
an exception is thrown, can it be caught?
I posted this message last week, but got no response. I am really hoping
someone can help me with...
|
by: Cider123 |
last post by:
I was originally using:
System.Windows.Forms.Timer
It started to lock my Window Service up, so I went to the next
evolution:
System.Threading.Timer
All was good. I was using it to send a message once a minute (to
|
by: Mark Rae |
last post by:
Hi,
I've seen several articles about using System Timers in ASP.NET solutions,
specifically setting them up in Global.asax' Application_OnStart event.
I'm thinking about the scenario where I might need to carry out some
back-end processing without pausing the individual users' Session while that
process runs.
E.g. I might provide the ability for a user to upload a text file of job
|
by: Bamse |
last post by:
Hi, can timers be used in webservices?
as an example: to check at some time interval an object -
Application and for each logged user, check its login
period, and if it is greater than 30 minutes, remove it form the
collection.
Thank you,
Daniel
| |
by: Michael C# |
last post by:
Hi all,
I set up a System.Timers.Time in my app. The code basically just updates
the screen, but since the processing performed is so CPU-intensive, I wanted
to make sure it gets updated regularly; like every 1.5 secs. or so. I only
ran into one issue - the MyTimer_Elapsed event handler was not updating the
screen correctly all the time, often leaving large chunks of the screen
un-painted for several seconds.
On a whim I decided to...
|
by: Maarten |
last post by:
Hi
In my aplication it seems that my timer slows down everything,
is there a better and/or diferent way than using a timer
Maarten
|
by: Liverpool fan |
last post by:
I have a windows application written using VB .NET that encompasses a
countdown timer modal dialog. The timer is a System.Timers.Timer with
an interval of 1 second. AutoReset is not set so accepts the default of
True. The Elapsed event handler updates the dialog box with how long
before it will close, acting as a timer itself. The dialog has a time
to close property which is checked every time the Elapsed event fires.
The problem I have...
|
by: archana |
last post by:
Hi all,
I am having application in which i am doing asynchronous call.I am
using manualresetevent to wait for asynchronous call to complete.
I want to stop asynchronous call after certain period of time.
I want something like thread.abort for aborting aynchronous call.
Can someone tell me way of aborting asynchronous call.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |