ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.
Database mode
Recommended reading
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.
Optimizely has introduced database mode configuration. The database mode configuration has two options: ReadWrite and ReadOnly (see the Configuration section below).
ReadWrite mode
The ReadWrite mode is the default mode and the application works as normal.
ReadOnly mode
In the ReadOnly mode, the application can only load data from database. The saving and updating operations by EPiServer.Data.IDatabaseHandler throw exceptions, which is why some modules are disabled or work differently. These 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 exception if updating is needed.
Statistics Logger is disabled.
Saving web config file into database is disabled.
Configuration
The database mode can be configured 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:
By default, HttpException returns status code 503 when accessing a protected module in the ReadOnly mode. You can override this behavior by listening to 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… }
Override the default ReadOnly page
Set the episerver:ReadOnlyInfoUrl appSetting to override the default ReadOnly page (~/Util/ReadOnly.aspx).