Try our conversational search powered by Generative AI!

Database writes are blocked (NotSupportedException) when adding license file to site in ReadOnly mode

Found in

EPiServer.CMS.Core 9.8.0

Fixed in

EPiServer.CMS.Core 10.2.0

(Or a related package)

Created

Oct 05, 2016

Updated

Dec 05, 2016

Area

CMS Core

State

Closed, Fixed and tested


Description

Steps to reproduce

1. Create an MVC site with no license.config file.
2. Change to ReadOnly mode.
3. Add license.config file.
4. Reload the site.

Expected: Show notification message about ReadOnly mode instead of exception.
Actual: Show exception as below.
Note: The issue can be reproduced in either local web server or Azure. The exception disappears after changing to ReadWrite then ReadOnly mode again.

System.NotSupportedException: Database writes are blocked since the application is set to ReadOnly mode. ReadOnly mode is set either by the 'databaseMode' attribute on the 'episerver.dataStore' section or by the 'episerver:DatabaseMode' setting under the 'appSettings' section.
at EPiServer.Data.Providers.Internal.ReadOnlySqlDatabaseHandler.ExecuteTransaction(Action action)
at EPiServer.Data.Dynamic.StoreDefinition.<>c_DisplayClass24_0.<InternalCreate>b_0()
at EPiServer.Data.Cache.Internal.LocalCache`2.Add(TKey key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 getAction, Action`2 setAction)
at EPiServer.Data.Cache.Internal.LocalCache`2.Add(TKey key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 action)
at EPiServer.Data.Dynamic.StoreDefinition.InternalCreate(String storeName, IDictionary`2 typeBag, StoreDefinitionParameters parameters)
at EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStoreFactory.CreateStore(String storeName, IDictionary`2 typeBag, StoreDefinitionParameters parameters)
at EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStoreFactory.CreateStore(String storeName, Type type, StoreDefinitionParameters parameters)
at EPiServer.Licensing.LicensingRepository.GetStore()
at EPiServer.Licensing.LicensingRepository.Get(Guid entityId)
at EPiServer.Licensing.LicensingRepository.GetLicense(Guid entityId, RSA key)
at EPiServer.Licensing.RestrictionTypes.CloudRestriction.InternalValidate()
at EPiServer.Licensing.LicenseData.GetValidationResults()
at EPiServer.Licensing.LicenseData.Validate()
at EPiServer.Licensing.WebApplicationLicenseCheck.ValidateLicense(Boolean throwOnError)
at EPiServer.Licensing.LicenseCheck.Test()
at EPiServer.Core.ContentProvider.CheckLicense()
at EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(ContentReference contentreference, ILanguageSelector selector)
at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions)
at EPiServer.Core.Internal.DefaultContentLoader.TryGet[T](ContentReference contentLink, LoaderOptions loaderOptions, T& content)
at EPiServer.Core.Internal.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions)
at EPiServer.Web.Routing.Segments.Internal.NodeSegment.RouteDataMatch(SegmentContext context)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at EPiServer.Web.Routing.Internal.DefaultContentRoute.RouteSegmentContext(SegmentContext segmentContext)
at EPiServer.Web.Routing.Internal.DefaultContentRoute.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at EPiServer.Web.Routing.RouteCollectionExtensions.HandleRouteData(RouteCollection routes, HttpContextBase context)
at EPiServer.Global.DefaultDocumentHandling(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)