Error when starting Commerce after update to latest version

Vote:
 

Hi,

After upgrading the Commerce site to version 10.5.1 I'm getting the following error and unfortunatly I can't find anything online about this. 

The error is the following:

Cannot register a module after the application has been initialized.

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.InvalidOperationException: Cannot register a module after the application has been initialized.

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:

[InvalidOperationException: Cannot register a module after the application has been initialized.]
   System.Web.DynamicModuleRegistry.Add(Type moduleType) +261
   System.Web.HttpApplication.RegisterModule(Type moduleType) +78
   EPiServer.Commerce.Internal.Migration.MigrationInitializationModule.Initialize(InitializationEngine context) +31
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +56
   EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +425

[InitializationException: Initialize action failed for Initialize on class EPiServer.Commerce.Internal.Migration.MigrationInitializationModule, EPiServer.Commerce.Internal.Migration, Version=10.5.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +965
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +192
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +916
   EPiServer.Framework.Initialization.InitializationModule.Init(HttpApplication context) +160
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Initialize action failed for Initialize on class EPiServer.Commerce.Internal.Migration.MigrationInitializationModule, EPiServer.Commerce.Internal.Migration, Version=10.5.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731

Has anyone else had this problem? Thanks!

/Mark

#178408
May 10, 2017 22:56
Vote:
 

Looks like some timing is off in the initialization. Make sure your global application class inherits the episerver global class to make sure the initialization engine runs at the right time, e.g. Global.asax should have the content

<%@ Application Language="C#" Inherits="EPiServer.Global" %>

Or if your Global.asax inherits your own global class, then that one in turn should inherit EPiServer.Global

#178441
May 11, 2017 6:17
Vote:
 

Thanks! I've figured it out. I installed the wrong packages.... :(

The hint was that there was no Global.asax.

Thanks for your help!

#178465
May 11, 2017 13:20
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.