Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
[New in Episerver Core 9.7.0]
Episerver has introduced database mode configuration. The database mode configuration has two options: ReadWrite and ReadOnly (see Configuration).
The ReadWrite mode is the default mode and the application works as normal.
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:
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 the ReadOnly mode by episerver.dataStore section:
<episerver.dataStore databaseMode="ReadOnly"></episerver.dataStore>
Example of setting ReadOnly mode by appsetting section:
<appSettings>
<add key="episerver:DatabaseMode" value="ReadOnly" />
</appSettings>
The IDatabaseMode can be used to find and detect the database mode by code:
ServiceLocator.Current.GetInstance<IDatabaseMode>().DatabaseMode
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… }
Set the episerver:ReadOnlyInfoUrl appSetting to override the default ReadOnly page (~/Util/ReadOnly.aspx)
<appSettings>
<add key="episerver:ReadOnlyInfoUrl" value="~/OurCustomReadOnlyPage.html" />
</appSettings>
Last updated: May 17, 2016