Configure scheduled content publishing for Kentico MVC projects
Technical | Kentico
Dragoljub Ilic

By Dragoljub Ilic | Software Developer 24.10.2018.

Configure scheduled content publishing for Kentico MVC projects

Kentico, like any other Content Management System (CMS), provides full control over content to Content Editors, people whose daily job is to maintain content on websites. Kentico offers some helpful tools to Content Editors. Maybe the most helpful one is the possibility to schedule content (un)publishing. This feature enables Content Editors to prepare a piece of content in advance before it goes live. That is the responsibility of a scheduled task called Content publishing.

Managing the content tree in Kentico MVC projects, and portal engine projects are the same. Scheduled content publishing in Kentico MVC projects works fine, but for pages under workflow, this feature fails. So, what can we do to solve this problem?

My team and I, we started by recreating the Content publishing scheduled task. To enable scheduled content publishing in the MVC project, you must create a scheduled task manually. Start by opening the Scheduled tasks application, select your MVC website from a drop-down menu in the top left corner and click New task button (see image below).

First step, open Scheduled task application and select MVC site in dropdown First step, open Scheduled task application and select MVC site in dropdown

The next step will be to configure the scheduled task with parameters as shown on the image below. Those parameters are the same as in a Content publishing task for portal engine projects.

Second step, configure newly created scheduled task Second step, configure newly created scheduled task

You can run this task in a separate thread to improve the performance of a website, whch can be accomplished by marking the checkbox Run task in separate thread at the bottom of the page (see image below). After this, your scheduled task is ready for use and content will be (un)published by the scheduled task itself.

Last step, configure the scheduled task to work in a separate thread Last step, configure the scheduled task to work in a separate thread

Important is that, like any other scheduled task, this one requires all CMS nodes in the web farm to be alive to make content scheduling valid, as well. This can be accomplished by changing settings on IIS level which will keep the application pool always on, or to use Kentico CMS Scheduler, which will execute tasks externally. The downside of Kentico CMS Scheduler is that it's available only under the Kentico EMS license.

If you're currently working on Kentico MVC projects and have applied a workflow or have a plan to do so, you need to keep in mind these things and configure your environment properly to avoid possible inconvenience in the future.

Dragoljub Ilic

By Dragoljub Ilic | Software Developer 24.10.2018.