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.
- 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
- In the SitefinityWebApp project, create a new folder and name it Warmup.
- Create a class UrlsPlugin.cs
- 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
- Navigate to Administration » Settings » Advanced settings » Warmup.
- Expand the Warmup node and then the Plugins node.
- 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.
- Save your changes.
As a result, you can see your newly created plugin in the Plugins node.
To add a plugin parameter:
- Navigate to Plugins » URLs Plugin » Parameters.
- Click Create new.
- Enter the following:
- Key: urlsFilePath
- Value: ~/App_Data/WarmupUrls.txt
- 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.