Timer in asp.net app.

  • Thread starter Thread starter Jensen Bredhal
  • Start date Start date
J

Jensen Bredhal

Hello,
I need to write a routine that get executed every 2 hours independantly in
the backround on my asp.net web application.
How can this be done?


Many thanks in advance

JB
 
Is this to process a database? Typically this stuff is not done in ASP.NET
but instead in a database procedure or another application running on the
server or client PC.

Chris
 
write a windows service for this or a separate exe. you can write a web
application with a timer which is a global instance, but that requires the
application to always be running for the timer to go off.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
 
write a windows service for this or a separate exe. you can write a web
application with a timer which is a global instance, but that requires the
application to always be running for the timer to go off.

If your site is hosted with a public ISP, chances are they will not allow
you to deploy your own Windows services, create SQL Server jobs etc. If this
is the case, System.Threading.Timer instatiated in the Appliction_OnStart
event in Global.asax is pretty much your only option.
 
http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/default.aspx

Read Tip 6 and get his example code, but basically you create a time in the
Global.aspx page in the application_start event. The example shows using an
HTTPModule, but my experimenting showed it worked just fine with the
application_start.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
, create SQL Server jobs etc. If this
is the case, System.Threading.Timer instatiated in the Appliction_OnStart
event in Global.asax is pretty much your only option.

I was mostly thinking of something like this.
So far it is not possible to call web services inside MS sql server write?
So that is not an option.

So i guess either this solution or a windows service might
be my only choices. We own the hosting environnement so we can always
install just one more app.

Many thanks
JB
 
Great!

JB
Wayne said:
http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/default.aspx

Read Tip 6 and get his example code, but basically you create a time in
the
Global.aspx page in the application_start event. The example shows using
an
HTTPModule, but my experimenting showed it worked just fine with the
application_start.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute.
But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
Back
Top