SaaS CMS has officially launched! Learn more now.

DBLocalization Provider in read-only database


Good morning.

Have any of you successfully used the dblocalization provider in a readonly database mode.  i cannot get this to work in a geo replicated db or in dxc enviroment.  Any help would be greatly appreciated.

Aug 20, 2019 18:34


actually I haven't tried that mode.. what's failing?

Aug 24, 2019 1:00

Hey Valdis,

I appears the syncronization of the DBLocalizationProvider is what is failing.  Let me get you the exact message.  Essentially, if with DXC and just geo replication of DB, it puts the database in readonly mode, it fails on startup.  

The line i see here is "DbLocalizationProvider.EPiServer.DbLocalizationProviderInitializationModule.DiscoverAndRegister(Object sender, EventArgs eventArgs) +171"

i remove dbloca... and it works just fine.  add it back and the error comes back.  Thanks for responding

[SqlException (0x80131904): Failed to update database "mydatabasename" because the database is read-only.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +212
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +81
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +630
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4222
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +952
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +304
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +283
   DbLocalizationProvider.Sync.ResourceSynchronizer.ResetSyncStatus() +99
   DbLocalizationProvider.Sync.ResourceSynchronizer.DiscoverAndRegister() +613
   DbLocalizationProvider.EPiServer.DbLocalizationProviderInitializationModule.DiscoverAndRegister(Object sender, EventArgs eventArgs) +171

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
   System.Delegate.DynamicInvokeImpl(Object[] args) +117
   EPiServer.Framework.Initialization.InitializationEngine.OnInitComplete() +195
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +172
   EPiServer.Framework.Initialization.InitializationEngine.Initialize() +41
   EPiServer.Framework.Initialization.<>c.<FrameworkInitialization>b__7_0(InitializationEngine e) +14
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +338
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +140
   EPiServer.Global..ctor() +43
   Calamos.Web.EPiServerApplication..ctor() +10
   ASP.global_asax..ctor() +38

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1088
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +59
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +148
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +659
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
Aug 24, 2019 21:05

oh, right. well.. you will have to accept my stupidity :) and wait for the next version with the fix.

Aug 25, 2019 9:06

Thank you Valdis.  Much Appreciated.

Aug 27, 2019 4:34

Hi Joshua,

Quick follow-up. It's not so that you have ReadOnly mode for database also for Episerver during startup? This is purely due to DXC env. + geo repl?

I'm looking for hook to get info that resource sync should be skipped..

Sep 13, 2019 20:18

release almost on the way out to feed..

Sep 13, 2019 22:29

Its not so much dxc or epi in readonly mode, is when the database is put into readonly mode which you will happen when Replication of DB is enabled in Azure.  I think, I am fairly confident, that if you have a DR site in DXC, they put the db in readonly mode as well.  This is where the issue arose and we were made aware the DR website will not come up if dblocalization provider is enabled on the site.  We use this in non DXC as well but GEO replication is enabled which forces readonly mode in azure.  So its in both senarios.  Thank you so much for you time with this matter Valdis.  Are you attending ASCEND IN Florida?

Sep 16, 2019 15:58

give it a shot for v5.7.4 (out now already).

and yes - will be in Florida :)

Sep 16, 2019 16:57
Joshua Folkerts - Sep 16, 2019 17:48
I like that. Thank you for taking care of this. Ill see you there. I owe you one :)
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.