Precompiler tool

Overview

Sitefinity CMS has a custom command-line tool for precompiling pages - Telerik.Sitefinity.Compiler.exe. It compiles the generated markup, retrieved from the markup service.

Since Sitefinity CMS pages are dynamically generated, their entire markup is retrieved via a service endpoint, which is available at /restapi/markup. From that endpoint, the markup for a requested page in a specific language is retrieved and prepared for compilation.

How the precompiler tool works

When a frontend page is requested, Sitefinity CMS tries to load the page from the precompiled assembly, if present. If the page is found in the assembly and its version matches the one that the page in the assembly was built with, the page from the assembly is loaded and served. If there is no match, the page is compiled dynamically.

IMPORTANT: The version of the page changes when one of the following actions occurs:
  • The page is published.
  • You edit any of the master pages that the page is based on, including any master pages which master pages are based on.
Once the page's version changes, it will no longer be loaded from the precompiled assembly, but, instead, from a dynamically generated satellite assembly.

NOTE: If you apply a change to a template, on which many pages are based, all of the pages based on it will have a different version and will be no longer loaded from the precompiled assembly.

Download and run the tool

Download Sitefinity CMS precompiler tool and extract the .zip files. The tool is Telerik.Sitefinity.Compiler.exe.
For more information about the commands you can use in the tool, see Reference: Command line arguments.

RECOMMENDATION: Since the tool uses a URL to connect to the site, and to retrieve the markup, we recommend to run the tool against the site which is connected to the most up-to-date database. The application directory of the Sitefinity CMS web application should contain the most up-to-date templates, user controls, master-pages stored on the file system, as well as the most up-to-date compiled application assemblies. For example, if you have two servers – a production and a staging server, the tool should be executed against the site with the most recent database changes (production server) with the application directory of the staging server.

Authentication

In order authenticate with Sitefinity CMS, the precompiler tool supports the following methods:

  • Authenticate with a username, password, and membership provider.
    Use the Username, Password, and MembershipProvider command line arguments, respectively.
    The authenticated user must be an administrator.
  • Authenticate with an authentication key.
    Use the AuthKey command line argument and specify the authentication key.
    You must have set the authentication key in Sitefinity CMS. To set an authentication key, log into Sitefinity's backend and in the main menu, click Administration » Settings » Advanced » Pages » Compilation. Set the key in the Authentication key field.

NOTE: Only one of the two authentication methods can be used at a given time. Authentication with an authentication key and the AuthKey argument has a higher priority over authentication with a username and a password.

IMPORTANT: You must always use authentication key in the following cases:
  • If you are using Windows authentication
  • When you have enabled the setting AuthenticateOnFrontendLoginPage located in Administration » Settings » Advanced » Security.

Antivirus software considerations

Scanning the files generated by the precompiler with certain antivirus software, may lead to an AppDomainUnloadException.
To work around this issue, you need to set the httpruntime/delayNotificationTimeout property in your web.config to a greater value, namely between 10 and 30 seconds. For more information, see HttpRuntimeSection.DelayNotificationTimeout Property.

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?