---
title: Database mode
slug: cms-11/dev-docs/database-mode
docTags: 
createdAt: 2026-07-22T19:45:21.613Z
---

The database mode configuration has ReadWrite and ReadOnly options.

## ReadWrite mode

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

## ReadOnly mode

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 disabled or work differently. The following modules and functions are affected in the ReadOnly mode:

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

## Configuration

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:

```csharp
{
  "EpiServer": {
    "Cms": {
      "DataAccess": {
        "DatabaseMode": "ReadOnly"
      }
    }
  }
}
<button class="button-toggle c-info-block__expand-button" 
        onclick="ShowHideTextSection(this,'randomid_d5a6e1a4-725f-8917-80ae-2425ec47547d')" 
        title="Code example CMS 10-11" 
        data-dom-toggle="collapse" 
        aria-expanded="false">Code example CMS 10-11</button>
```

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

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

Example of setting ReadOnly mode by `appsetting` section:

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

## Find Database mode by code

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

```csharp
ServiceLocator.Current.GetInstance<IDatabaseMode>().DatabaseMode
```

## 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.

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