HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Database mode

Describes database mode configuration.

The database mode configuration has two options: ReadWrite and ReadOnly.


The ReadWrite mode is the default mode, and the application works normally.


In the ReadOnly mode, the application can only load data from the database. The saving and updating operations by EPiServer.Data.IDatabaseHandler throw exceptions, which is why some modules are turned off or work differently. The following modules and functions are affected in the ReadOnly mode:

  • Scheduler Service is turned off.
  • Model synch is turned off.
  • Indexing of content is turned off.
  • User, role, and claims synch are turned off.
  • Automatic database updating throws an exception if updating is needed.
  • The Statistics Logger is turned off.
  • Saving web.config file into database is turned off.


You can configure the database mode by the databaseMode attribute on the episerver.dataStore section or by the episerver:DatabaseMode setting under the appSettings section.

Example of setting ReadOnly mode by appsetting.json section:

      "EpiServer": {
        "Cms": {
          "DataAccess": {
            "DatabaseMode": "ReadOnly"
<button class="button-toggle c-info-block__expand-button" 
        title="Code example CMS 10-11" 
        Code example CMS 10-11

Example of setting the ReadOnly mode by episerver.dataStore section:

<episerver.dataStore databaseMode="ReadOnly"></episerver.dataStore>

Example of setting ReadOnly mode by appsetting section:

  <add key="episerver:DatabaseMode" value="ReadOnly" />

Find database mode by code

Use the IDatabaseMode to find and detect the database mode by code:


Access Protected Module in the ReadOnly mode

By default, HttpException returns status code 503 when accessing a protected module in the ReadOnly mode. You can override this behavior by monitoring the AccessPath event.

ServiceLocator.Current.GetInstance<IAccessReadOnlyProtectedModules>().AccessPath += (object sender, ReadOnlyProtectedModuleEventArgs e) =>
  { e.Handled = true; // Put your code here redirect to a custom readonly page… }