Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create a timer to do scheduled jobs in web application?

1 view
Skip to first unread message

elaine

unread,
Apr 16, 2008, 4:41:46 PM4/16/08
to
I have a web appliacation, what i want to do is starting a timer when
"Application_Start" event handler is called. The timer is running
asyncronizely, let's say, every 24 hours, it will create a new thread
to run a certain process, after the process is done, the thread will
be killed.

So far, i have no idea how to do it. Can i instantiate a singleton
object in "Application_Start"? How to make a timer to be running
asyncronizely?

Please help,
Elaine

Eliyahu Goldin

unread,
Apr 17, 2008, 4:46:50 AM4/17/08
to
Web applications are not good for this sort of task. Web application
response to client requests and doing something with them outside of client
requests is not what they are for.

Typically, you would either use Windows scheduler or make your own Windows
service.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"elaine" <elai...@gmail.com> wrote in message
news:bbf6c235-e15d-49c9...@w1g2000prd.googlegroups.com...

Holger Kreissl

unread,
Apr 17, 2008, 4:57:19 AM4/17/08
to
What you describe should not be part of the webserver process because it
would be a bad design. You want to trigger a Process X that does something.
So use database triggers, task planer or create an own processes or windows
service that implements the Process X. Encapsulate your logic you wanted to
do in your web application into a assembly and reference it to your process.

--
Holger Kreissl
.NET Software Developer
http://kreissl.blogspot.com/

Jim in Arizona

unread,
Apr 17, 2008, 1:05:01 PM4/17/08
to
"elaine" <elai...@gmail.com> wrote in message
news:bbf6c235-e15d-49c9...@w1g2000prd.googlegroups.com...


As with the others, I have to agree that creating your own services would
probably be a good idea for this. You could have the web app start the
service using the system.serviceprocess.servicecontroller class and then
have that service take over from there with its own timer and, after the
elapsed time, shut itself down. I've created similar services like this
before and its fairly easy (in most cases I'm sure).

If you need further assistance, reply back.

HTH,
Jim


0 new messages