scheduling thru posting on a public webhost??

I

Ivan Demkovitch

Hi!

If I understand caching properly:

1. Create object in cache and set expiration Time to let's say 1 minute
2. Specify delegate which will be called on object expiration. Here we will
restore object and do some other stuff.

Basically we have timer-like application which lives by itself without
user's hitting website.

Does anybody use this technique to schedule events or some specific
processing?
 
S

Scott Allen

A more explicit way to handle scheduled / timed events from inside an
ASP.NET application is to create a System.Timers.Timer object during
the Application_Start event in global.asax.

i.e.

protected void Application_Start(Object sender, EventArgs e)
{
System.Timers.Timer myTimer = new System.Timers.Timer();
myTimer.Enabled = true;
myTimer.Interval = (60000 * 15);
myTimer.Elapsed +=
new System.Timers.ElapsedEventHandler(myTimer_Elapsed);

}

protected void myTimer_Elapsed(
object sender,
System.Timers.ElapsedEventArgs e
)
{
// do some work
}


I wouldn't use the cache expiration to do anything other than refresh
the cache. Any other behavior might not be obvious to someone coming
in to do maintenance on the softwrae.

HTH,
 
A

Annick Van Hoof

Whatever you do, note that your schedule will stop when the server is
rebooted, or IIS is restarted.
Then you'll have to wait until the first visitor visits your page ...
Hopefully you have a real busy page ...

Wim
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top