---
title: Configuring scheduled task execution
related:
  - https://docs.kentico.com/k8/custom-development/miscellaneous-custom-development-tasks/scheduling-custom-tasks.md
  - https://docs.kentico.com/k8/configuring-kentico/scheduling-tasks/reference-scheduled-task-properties.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

This page explains how to configure execution of scheduled tasks. Scheduled tasks can be executed:

- [By the Kentico web application itself](#configuring-execution-by-the-kentico-application)
- [By a dedicated external Windows service](#configuring-execution-by-the-windows-service)

You can have both approaches enabled and execute some tasks directly in Kentico and other tasks via the external Windows service.

> **Info:** **Scheduling reliability**
>
> Task execution by the Kentico application runs within the ASP.NET process, so tasks cannot be executed if the web application is not running. The application stops running when the process is recycled without being started again (after a long period of website inactivity).
>
> If you want to run the scheduling reliably, we recommend using the Windows scheduling service.
>
> To achieve reliable task execution without using the Windows scheduling service, you need to ensure that your website is always running. For example, you can prepare a utility or service that requests the home of your website on a regular basis.

## Configuring execution by the Kentico application

By default, all scheduled tasks are executed by the Kentico application.

### Setting the task execution time

There are two levels of settings that determine when the system executes tasks:

- **Task interval** - the properties of individual scheduled tasks determine when tasks are ready for execution.
- \*\*Application scheduler interval -\*\*determines the time interval after which the application checks if any tasks are ready to be executed.

#### Task interval

To configure the interval that determines when individual scheduled tasks are ready to be executed:

1. Open the **Scheduled tasks** application.
2. Edit () the scheduled task.
3. Set the task's scheduling options (Period, Start time, Every, Between, Days).
4. Click **Save**.

#### Application scheduler interval

To configure how frequently the application checks if there are any tasks ready to be executed:

1. Open the **Settings** application.
2. Select the **System** category.
3. Type a number of seconds into the **Application scheduler interval** setting.
4. Click **Save**.

Execution of scheduled tasks by the Kentico application has two modes.

**Request-based scheduler mode**

This is the default mode. The application performs checks at the end of each standard page request. This means that tasks are only executed when user activity on your website generates requests.

In this case, the **Application scheduler interval** sets the minimum time between the checks:

- For example, a value of 60 means that the application checks after 60 seconds even if multiple page requests occur per minute. Tasks are NOT executed if there are no page requests.
- 0 disables the execution of tasks by the application.

**Automatic scheduler mode**

You can configure the scheduler to process tasks regularly according to an **automatic internal timer**, regardless of website activity. To enable this mode, add the **CMSUseAutomaticScheduler** key into the _/configuration/appSettings_ section of your web.config file:

```html

<add key="CMSUseAutomaticScheduler" value="true" />

```

In this case, the **Application scheduler interval** sets the precise interval between the checks:

- Values between 1 - 30 seconds define the **interval** between checks. For example, a value of 30 means that the application checks tasks every 30 seconds.
- 0 disables the execution of tasks by the application.

## Configuring execution by the Windows service

Executing tasks using the external Windows service is recommended for resource‑consuming tasks, because the execution does not affect the performance of the Kentico application.

### Enabling the Windows scheduler service

> **Warning:** **Prerequisites**
>
> You need to have the [Kentico Scheduler Windows service](https://docs.kentico.com/k8/configuring-kentico/scheduling-tasks/installing-the-scheduler-windows-service.md) installed and running.

> **Note:** **Note**
>
> Only some of the default scheduled tasks support this option. The tasks that do not have the option available in the editing interface must be processed by the application itself.

1. Open the **Settings** application.
2. Select the **System** category.
3. Enable the **Use external service** setting.
4. In the **Scheduled tasks** application, enable the **Use external service** option for individual tasks.

   - Tasks with the **Use external service** option disabled will be executed by the Kentico application itself.
   - If the **Use external service** setting in the **Settings** application is disabled, even tasks with the **Use external service** option enabled are processed by the Kentico application itself.

> **Note:** **Resolving context macros when executing tasks by the Windows service**
>
> Tasks that are executed by the Windows service cannot resolve [macros](https://docs.kentico.com/k8/macro-expressions.md) dependent on application context (for example _{% ApplicationPath %}_). The context is not available when tasks are executed outside the application. Therefore, you cannot execute such tasks using the Windows service.

### Setting the task execution time

There are two levels of settings that determine when the Windows scheduler service executes tasks:

- **Task interval** - the properties of individual scheduled tasks determine when tasks are ready for execution.
- **Service scheduler interval -** determines the time interval after which the service checks if any tasks are ready to be executed.

#### Task interval

To configure the interval that determines when individual scheduled tasks are ready to be executed:

1. Open the **Scheduled tasks** application.
2. Edit () the scheduled task.
3. Set the task's scheduling options (Period, Start time, Every, Between, Days).
4. Click **Save**.

#### Service scheduler interval

To configure how frequently the Windows scheduler service checks if there are any tasks ready to be executed:

1. Open the **Settings** application.
2. Select the **System** category.
3. Type a number of seconds into the **Service scheduler interval** setting.
4. Click **Save**.

> **Info:** This setting only applies to tasks that are configured to be executed by the Windows service, not by the application itself.

The **Service scheduler interval** sets the precise interval between the checks:

- Values between 1 - 30 seconds define the **interval** between checks.
  - For example, a value 30 means, that the service checks tasks every 30 seconds.
- 0 disables the execution of tasks by the external service.

## Additional low-level settings

Additional low-level scheduled task settings can be done by adding the keys listed in the **Scheduler settings** section of the [Web.config application keys](https://docs.kentico.com/k8/references/reference-web-config-application-keys.md) reference.
