The Commerce Engine startup process

Current version: 10.2

There are three main files that control how the Commerce Engine starts up and how it behaves:

  • The startup.cs class file, a standard .Net Core class, is the main class used to register services with the .Net Core application.

  • The program.cs class file, a lightweight, standard .Net Core construct class is the first file used to boot the application.

  • The config.json file is the Commerce Engine configuration file used to configure the startup of the engine. It contains a reference to the bootstrap file (the global.json file) that is is used to load the default configuration file for the Commerce Engine in the startup.cs. Typically, the configuration within this file controls how services are added to the engine via dependency injection and other methods. Modification to the config.json is typically rare. When required, follow best practices.

Best practices for working with the startup.cs and program.cs classes

We recommend that you follow best practices when you work with the startup.cs and program.cs classes:

  • Do not rename, move, or delete the startup.cs and program.cs files.

  • Do not remove existing code within the startup.cs and program.cs files, nor modify the structure of the files content in a way that:

    • Changes, breaks, or otherwise disables the loading of the global.json or config.json files.

    • Changes, breaks, or otherwise disables the default security functionality of the application.


      Any change to the default security setup of the Commerce Engine can expose your deployment to security risks. Sitecore cannot be held responsible of the consequences of altering the Commerce Engine's default security functionality.

    • Changes, breaks, or otherwise disables the default logging functionality of the application.

  • You must not break existing Commerce Engine functionality when you add your new functionality to the appropriate location in the startup.cs file. For example, a custom plugin can require that you add new services to register in the startup.cs file.

  • When possible, add new code towards the end of the modified methods within the startup.cs or program.cs files.

Do you have some feedback for us?

If you have suggestions for improving this article,