Episerver Scheduled Tasks
This section will explain what scheduled jobs/tasks are, how you can create and debug them.
What Is A Scheduled Task?
Simply put, an Episerver scheduled task is a mechanism within Episerver that you can use run specific code at a specified interval. If you’re looking for a way to execute a certain command several times a day, at a certain time of day, week or, month, then this is what you use. You can create a scheduled Jobs/Tasks by creating a C# class and inheriting the correct attribute to it, like so:
Your custom code will then be run as a background at a specified frequency, time, date etc… One important thing to note is that when you code runs within a scheduled task, it won’t have the same HTTP Context as a normal user. Scheduled tasks will be run by your application pools identify and not a web user, so things like HTTPContext won’t exist. I’ve definitely wasted a few hours wondering why a task worked when I tested it manually (which will cause the HTTPContext to exist) and why it failed when it was scheduled.
To get started I suggest you read these posts: