Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » LanguageCulture - System.IndexOutOfRangeException

LanguageCulture - System.IndexOutOfRangeException

Daniel Hollmann
Reply

Hi.

I’m trying to upgrade a custom solution that should go from 9.10.14 to 9.14.16 (latest).


What I did was this:

1) Downloaded the new Application folder and placed it with my other appilcaion folders.
2) Copied the new .dll’s to my custom directory.
3) Switch the admin directory to the new Application folder.


This worked fine for my local setup, however I encountered this error, when I did it to my cloud solution.

I experienced the same error, when I pointed my local environment to the could database.
Any ideas what to do about this error?

Server Error in '/' Application.


LanguageCulture

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: LanguageCulture

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
 

[IndexOutOfRangeException: LanguageCulture]
   System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) +2158379
   System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) +141
   System.Data.SqlClient.SqlDataReader.get_Item(String name) +21
   Dynamicweb.Ecommerce.International.LanguageRepository.ExtractLanguage(IDataReader reader) +368
   Dynamicweb.Ecommerce.International.LanguageRepository.GetLanguages() +196
   Dynamicweb.Ecommerce.International.LanguageService.InitializeLanguageIndex() +107
   Dynamicweb.Caching.DictionaryCache`2.InitializeCacheDictionary() +155
   System.Lazy`1.CreateValue() +734
   System.Lazy`1.LazyInitValue() +450
   Dynamicweb.Caching.DictionaryCache`2.GetAllValuesInternal() +27
   Dynamicweb.Caching.ServiceCache`2.GetAllValues() +106
   Dynamicweb.Ecommerce.International.LanguageService.GetDefaultLanguage() +46
   Dynamicweb.Ecommerce.Common.Context.GetLanguage() +667
   Dynamicweb.Ecommerce.Frontend.EcomAuthenticateRequestNotificationSubscriber.OnNotify(String notification, NotificationArgs args) +226
   Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs) +875
   Dynamicweb.Admin.GlobalAsaxHandlerProxy.Application_AuthenticateRequest(Object sender, EventArgs e) +415
   Dynamicweb.Admin.Global.Application_AuthenticateRequest(Object sender, EventArgs e) +67
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0

 


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

That's a database schema issue. Your database is missing the LanguageCulture column. Try recycling the application and try again. Failing that, go to Setting | System | System information, change the version number to before the version you are upgrading from and hit Rerun updates. It looks like LanguageCulture was added in version 2223 so try a number below that.

Imar

 

 
Daniel Hollmann
Reply

Thanks for the tip!

 

Unfortunately I can’t even get back to my old version now.
When I switch admin directory back to 9.10.14, and put back my old custom directory (I had a backup)
I see this error

So I have no real way of accesing the admin interface anymore :/

Server Error in '/' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
 

[NullReferenceException: Object reference not set to an instance of an object.]
   Dynamicweb.Security.Permissions.PermissionContext.EnsureContextIsOnTopOfStack(PermissionContext permissionContext) +66
   Dynamicweb.Security.Permissions.PermissionContext.get_AnonymousPermissionContext() +25
   Dynamicweb.Security.Permissions.PermissionContext.Frontend() +34
   Dynamicweb.Security.Permissions.PermissionControlledExtension.GetPermission(IPermissionControlled obj) +72
   Dynamicweb.Security.Permissions.PermissionControlledExtension.HasPermission(IPermissionControlled obj, PermissionLevel level) +25
   Dynamicweb.Content.ContentPermissionHelper.HasAccessToPage(Page page, PermissionLevel permission) +30
   Dynamicweb.Frontend.PageView.Load() +1818
   Dynamicweb.AspNet.DynamicwebHttpHandler.ProcessRequest(HttpContext context) +41
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +26
   System.Web.StepInvoker.Invoke(Action executionStep) +107
   System.Web.<>c__DisplayClass4_0.<Invoke>b__0() +23
   Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step) +64
   System.Web.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction) +56
   System.Web.StepInvoker.Invoke(Action executionStep) +91
   System.Web.<>c__DisplayClass4_0.<Invoke>b__0() +23
   Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step) +124
   System.Web.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction) +56
   System.Web.StepInvoker.Invoke(Action executionStep) +91
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +9956702
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0

 
Daniel Hollmann
Reply

[Double post error]

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Upgrade to 9.14, locate /Files/update.xml and /Files/UpdateVersion_ecom.xml and set both files to 2000 and restart your IIS.

These files contains information about the Dynamicweb database schema version - and you have deployed those from your local environment to your production environment where the database is not in this version.

By resetting the numbers and restarting IIS, those database updates should be applied.

 
Daniel Hollmann
Reply

Hi.

I tried to do this. My version in the update.xml and updateversion_ecom.xml was above 2000. But when I then updated the files to contain 2000, it's not updated even after a restart. Solution is hosted on Azure. I also tried to go to the globalsettings.config, and set the last seen version back to 9.10.14. That is updated as soon as the solution is restarted but the updates files seems to not be running on restart.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Ensure that the sql user has sufficient permissions for that database...

 

 
Daniel Hollmann
Reply

Hi I checked the premissions, double checked and tried to use the db_owner account aswell.. The update scripts does not seem to run at all..
Anyway to manually run the update? (Currently I can't access the admin interface, not even by downgrading).

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Are there any errors in the update log file? /Files/updatelog.log

 
Daniel Hollmann
Reply

All I have is in this file I have attached.
Looking at the timestamps, it looks to be from where the solution was installed in 2021

 
Daniel Hollmann
Reply

All I have is in this file I have attached.
Looking at the timestamps, it looks to be from where the solution was installed in 2021

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Are you using an application folder with a custom Global.asax file?
Try to use the Global.asax file from the standard application instead.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Is your application folder based on the standard application folder or did you only copy dynamicweb assemblies to an existing custom application folder?
If so, then you are probably missing a lot of files in the /Admin folder.

Try to start from scratch with an application folder based on a standard 9.14.16 application - without anyting custom.
When you have verified that the application can run on a standard 9.14.16 then add any custom assemblies to the /bin folder and test again.

 
Daniel Hollmann
Reply

The /Admin folder is a virtual directory, so is the /Files directory. The Physical path is my custom folder that contains the /bin folder with DW and custom ddls. It also cotains a Web.config file and a Global.asax.

I was told by a DW consultant to set it up this way, so it would be easy to upgrade in the future.

The Global.asax only contains this line and its the same in the /Application(9.14.6)/Global.asax as in my custom folder:
<%@ Application Codebehind="Global.asax.vb" Inherits="Dynamicweb.Admin.Global" %>


I copied all the files from the /Applicaition(9.14.6)/bin folder into my custom folder with the override option, so I should not be missing any files. 

Since this worked locally but not on my could instance, I think that the issue is that the upgrade scripts is not able to run for some reason on my cloud enviroment. 

 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Daniel

Yes - your database is missing some fields - in the first exception it is the field 

LanguageCulture

That should be in EcomLangauge table.

Ensure you reset the update config files as i described in my previous post.

Your log file shows that no updates have been run since august 21.

Also ensure to read this article: https://doc.dynamicweb.com/get-started/introduction/installation-dw9/upgrading-dynamicweb​

 
Daniel Hollmann
Reply

There was a problem running the update in the Azure setup I had. Even though the database user had all the correct rights, the update for some reason did not run on a reset.
I restored the database and did the update locally and restored it again in the cloud environment. After that solution worked again.

 

Thanks for the help everyone

 

You must be logged in to post in the forum