Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
elaine - 16 Apr 2008 21:41 GMT
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 - 17 Apr 2008 09:46 GMT
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.

Signature

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

>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
[quoted text clipped - 8 lines]
> Please help,
> Elaine
Holger Kreissl - 17 Apr 2008 09:57 GMT
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.

Signature

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

>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
[quoted text clipped - 8 lines]
> Please help,
> Elaine
Jim in Arizona - 17 Apr 2008 18:05 GMT
>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
[quoted text clipped - 8 lines]
> Please help,
> Elaine

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.