Implement a Warmup service plugin

In this tutorial, you implement a custom Warmup service plugin with High priority that enables you to specify a list within a text file with exact URLs of pages you want request during system restart.

  1. Create the text file, for example, WarmupUrls.txt, with the absolute URLs that are to be requested during warmup.
    The URLs need to be separated by a new line, for example:
    • http://my-site.com/Home
    • https://my-site-2.com/About
  2. In the SitefinityWebApp project, create a new folder and name it Warmup.
  3. Create a class UrlsPlugin.cs
  4. In the UrlsPlugin class, paste the following code:

Next, you add the plugin configuration in the backend or on the file system. Refer to the following sections. 

Add the plugin configuration in the backend

  1. Navigate to Administration » Settings » Advanced settings » Warmup.
  2. Expand the Warmup node and then the Plugins node.
  3. Click Create new and enter values the following fields:
    • Name: URLs Plugin
    • Type: SitefinityWebApp.Warmup.UrlsPlugin
    • Make sure the Enabled checkbox is selected.
    • Set the priority to High.
  4. Save your changes.

As a result, you can see your newly created plugin in the Plugins node.

To add a plugin parameter:

  1. Navigate to Plugins » URLs Plugin » Parameters.
  2. Click Create new.
  3. Enter the following:
    • Key: urlsFilePath
    • Value: ~/App_Data/WarmupUrls.txt
  4. Save your changes.

After full restart of your site, the Warmup service can leverage the URLs Plugin.

Add the plugin configuration on the file system

In the ~/App_Data/Sitefinity/Configuration folder of your application create a WarmupConfig.config file and paste the following code:

NOTE: The urlsFilePath parameter specifies the application’s relative path to the text file that contains the list with absolute URLs to be requested during warmup.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?