I would like to run a time consuming script (to update a database from a 3rd party API) at regular intervals. I was wondering what the best practice for this would be:
- What should the ‘script’ be – an ASP.NET service? Bearing in mind I am on shared hosting, this may not be possible (but I would like to know).
- How could the script be scheduled to run at regular intervals/at set time automatically?
Thanks in advance!
What you can do is add a System.Timers.Timer in Global.asax.
In IISManager, enable HTTP-Keep Alives for your application.
In IIS Manager, select Http Response Headers Module, open it and in the Actions Pane, select Set Common Headers and in there select Enable Http Keep Alives.
Also, check for a setting of your application pool –
Select the application pool of your application, select Advanced Settings from the right Actions Tab.
In there there is a setting called – Idle Timeout (minutes)
By default it is 20 Minutes. Make it something like 60 Minutes or increase it even more and check.