What is the most effective way to execute a method in the Global.asax file every x number of minutes? Is there a way to have the ASP.NET server run a background thread that fires a tick event after a certain elapsed period?
You could have a timer in the Application_Start of the Global.asax, but this is not very flexible since you need to do a request to the application for the timer to start. There are dangers to doing it this way though, as detailed by Haacked:
A better way of doing it is to have a web service that acts as an interface to your ASP.NET application and have a windows service that calls your web service on scheduled intervals:
More details here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With