Sitecore 9 Config Layers – Load Sequence

Most of you are at the Sitecore Symposium 2017 in Vegas with me to witness the launch of Sitecore 9.

One feature which has been refined in this release is the loading of the Configuration files. We can find a ton of code and modules for this specific section to control what gets loaded first etc.

Not the official logo. Credit goes to Kamruz Jaman for creating it.

 

With Sitecore 9 the configuration loading is organized in the layers. With the introduction of layers, we have a new config file in App_Config called Layers.config. The following is an example:

Load Order

First Sitecore reads Web.Config, App_Config\ConnectionStrings.config and App_Config\Layers.config.

As you can see from the screenshot above, Layers.config by default contains 4 layers and they are loaded in the sequence as defined in the Layers.config file.

  1. Sitecore configs
  2. Module configs (modules such as SPE, Publishing service etc)
  3. Custom configs (all your customizations to Sitecore)
  4. and lastly Environment configs (Environment specific configs)

You can customize the config load order and create additional config layers to suite your development needs.

By default: With in each Layer, configuration files are loaded Alphabetically first from the base folder and then the sub-folders.

You can alter this behavior by specifying a specific folder load order as shown in the Sitecore layer in the above screenshot. You can also disable a layer by adding mode=”off” for that specific layer in the Layers.config file. This is a neat way to disable all custom configs to work on a bug.

As always, please please please use Patch configs to modify Sitecore functionality.

You can always check your configuration using the Showconfig.aspx file.

If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).

2 thoughts on “Sitecore 9 Config Layers – Load Sequence”

Leave a Reply

Your email address will not be published. Required fields are marked *