---
title: Processing scheduled tasks when developing MVC applications
related:
  - https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks.md
  - https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks/installing-the-scheduler-windows-service.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).

When using a separate MVC application together with a Kentico application, you need to ensure that [scheduled tasks](https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks.md) on the Kentico application get processed in regular intervals. As the Kentico application itself does not usually receive traffic from site visitors, you either need to keep the application alive in a different way or process the tasks independently on the Kentico application's worker process.

You can use one of the following approaches for processing scheduled tasks when developing MVC applications:

- Automatic scheduler mode – recommended approach. Requires the Kentico application's worker process to remain alive.
- Scheduler Windows service – independent of the Kentico application's worker process.

### Automatic scheduler mode

1. Configure the Kentico application to use [Automatic scheduler mode](https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks/configuring-scheduled-task-execution.md#configuringscheduledtaskexecution-automaticmode).
2. Set the [Idle Time-out (minutes)](https://technet.microsoft.com/en-us/library/cc771956\(v=ws.10\).aspx) setting of your IIS application pool to 0. Otherwise, the application pool worker process shuts down after a period of inactivity. As the Kentico application does not receive traffic from visitors, the worker process would shut down if no one used the Kentico administration for a certain period of time and scheduled tasks would not get executed.

   - If you do not want to set the _Idle Time-out (minutes)_ setting to 0, you can keep the worker process alive by sending requests to the Kentico application within the set interval.

### Scheduler Windows service

You can use the [Scheduler Windows service](https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks/installing-the-scheduler-windows-service.md) if you want to process scheduled tasks independently on the Kentico application.

> **Note:** **Note**:
>
> - The Windows scheduler service requires the Kentico EMS license.
> - Tasks that are processed by the Windows service cannot resolve macros dependent on application context, such as: _{% ApplicationPath %}._

## Example - Regularly processing search indexing tasks on MVC sites

To use the scheduler to regularly process [search indexing tasks](https://docs.kentico.com/k11/configuring-kentico/setting-up-search-on-your-website/monitoring-search-indexing-tasks.md), configure the appropriate scheduled tasks to run using the Scheduler Windows service.

> **Info:** As a prerequisite, you need to:
>
> 1. [Install the Scheduler Windows service](https://docs.kentico.com/k11/configuring-kentico/scheduling-tasks/installing-the-scheduler-windows-service.md).
> 2. Open the **Settings** application in Kentico.
> 3. Expand the **System** category and enable the **Use external service** setting.
> 4. Click **Save**.

1. Open the **Scheduled tasks** application.
2. Edit the **Execute Azure search tasks** item (for [Azure Search indexes](https://docs.kentico.com/k11/configuring-kentico/setting-up-search-on-your-website/using-azure-search.md)).
3. Enable the **Use external service** property.
4. Click **Save**.
5. Repeat the same steps for the **Execute local search tasks** scheduled task (for [locally stored search indexes](https://docs.kentico.com/k11/configuring-kentico/setting-up-search-on-your-website/using-locally-stored-search-indexes.md)).

The system now processes search tasks generated by both the MVC and Kentico application using the Windows scheduler service.
