Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Object reference error in initialization modules

Vote:
 

I've recently upgraded our version of episerver CMS and Commerce from version CMS-9.12.2/Commerce-9.24.2  to  CMS-11.7.1/Commerce-12.2.0 and I receive the following error when trying to run the front end site.  I've seen articles similar to this saying to run the migration tool by navigating to the front end site, however there is the problem, this error occurs when trying to go to the front end site.  So this does not help:  https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2016/11/episerver-commerce-10-0-1-0-quotobject-reference-not-set-to-an-instance-of-an-objectquot-on-startup/    Is there a way to run the migration steps manually?

[NullReferenceException: Object reference not set to an instance of an object.]

   EPiServer.Web.Hosting.VirtualPathRegistrationHandler.CreateVirtualPathProviderInstance(ProviderSettings providerSettings) +59
   EPiServer.Web.Hosting.VirtualPathRegistrationHandler.RegisterVirtualPathProvidersFromSettings(ProviderSettingsCollection settings) +127
   EPiServer.Web.Hosting.VirtualPathRegistrationHandler.RegisterVirtualPathProviders(InitializationEngine context, ProviderSettingsCollection settings) +40
   EPiServer.Framework.Initialization.Internal.VirtualPathProviderInitialization.RegisterVirtualPathProviders(InitializationEngine context) +179
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +54
   EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +122
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +247

[InitializationException: Initialize action failed for Initialize on class EPiServer.Framework.Initialization.Internal.VirtualPathProviderInitialization, EPiServer.Framework.AspNet, Version=11.8.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +844
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +200
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +940
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +227
   EPiServer.Global..ctor() +103
   Turn5.AM.Web.UI.Global..ctor() +37
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\e4078215\c990ab3f\App_global.asax.0.cs:0

[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) +197
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1484
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +289
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +313
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +359

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +117
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726


#########################################################################################################################################################

I've tried going directly to commerce manager and get the following:

There are incomplete migration steps. The site can be in unstable state. Please navigate to front-end site and complete remaining migration steps, then restart Commerce Manager site. If you see this message on the front-end site, it means no Catalog Content models (decorated with the CatalogContentType attribute) were found. Add a Catalog Content type, or set the appSetting 'episerver:SkipCatalogContentModelCheck' to true to bypass this check. Warning! Bypassing this  check in the Commerce Manager site or other application which does not have the content model types available could lead to data loss!

Steps undertaken during the upgrade:

  1. Upgraded all nuget packages:
    1. EPiServer.CMS
    2. EPiServer.CMS.Core
    3. EPiServer.CMS.UI
    4. EPiServer.Cms.UI.Core
    5. EPiServer.Cms.TinyMCE
    6. EPiServer.Commerce
    7. EPiServer.Commerce.Core
    8. EPiServer.Commerce.UI
    9. EPiServer.CommerceManager
    10. EPiServer.Packaging (removed this from commerce manager sites to resolve a similar issue)
    11. EPiServer.ServiceLocation.StructureMap
  2. Upgraded databases
    1. Upgrade scripts
    2. Converted DB to UTM
  3. Fixed breaking changes in our codebase

Any insight would be much appeciated.

#193576
May 31, 2018 16:03
Vote:
 

Hi,  on phone can' t check now but I think you should look into Episerverframework.config. it looks like one virtual path provider is using the type from EPiServer.Framework instead of EPiServer.Framework.AspNet as it should

#193581
May 31, 2018 18:11
Vote:
 

Here is my episerverframework.config, it looks like I am referencing the EPiServer.Framework.AspNet virtual path provider.  Anything else in here look off?

<episerver.framework>
<scanAssembly forceBinFolderScan="true" />
<virtualPathProviders>
<clear />
<add virtualPath="~/AMEPiServer/" physicalPath="modules\_protected" name="ProtectedAddons" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet" />
<add showInFileManager="false" virtualName="DynamicContentPreview" virtualPath="~/Edit/Dialogs/DynamicContentPreview.aspx" bypassAccessCheck="false" name="DynamicContentPreview" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer" />
</virtualPathProviders>
<virtualPathMappings>
<add url="~/AMEPiServer/CMS/Editor/Dialogs/DynamicContentPreview.aspx" mappedUrl="~/Edit/Dialogs/DynamicContentPreview.aspx" />
</virtualPathMappings>
<virtualRoles replacePrincipal="true">
<providers>
<add name="Administrators" type="EPiServer.Security.WindowsAdministratorsRole, EPiServer.Framework" />
<add name="Everyone" type="EPiServer.Security.EveryoneRole, EPiServer.Framework" />
<add name="Authenticated" type="EPiServer.Security.AuthenticatedRole, EPiServer.Framework" />
<add name="Anonymous" type="EPiServer.Security.AnonymousRole, EPiServer.Framework" />
<add roles="WebAdmins, Administrators" mode="Any" name="PackagingAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" />
<add roles="WebAdmins, Administrators" mode="Any" name="CmsAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" />
<add roles="WebEditors" mode="Any" name="CmsEditors" type="EPiServer.Security.MappedRole, EPiServer.Framework" />
<add name="Creator" type="EPiServer.Security.CreatorRole, EPiServer" />
<add name="CommerceAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebAdmins, Administrators" mode="Any" />
</providers>
</virtualRoles>
<geolocation defaultProvider="maxmind">
<providers>
<add databaseFileName="App_Data\GeoLiteCity.dat" name="maxmind" type="EPiServer.Personalization.Providers.MaxMind.GeolocationProvider, EPiServer.ApplicationModules" />
</providers>
</geolocation>
<appData basePath="C:\EPiServer\VPP\AmericanMuscle.com\" />
</episerver.framework>

#193582
May 31, 2018 18:20
Vote:
 

If there's anything else you need to look at, please let me know

#193585
May 31, 2018 18:30
Vote:
 

virtualName="DynamicContentPreview" virtualPath="~/Edit/Dialogs/DynamicContentPreview.aspx" bypassAccessCheck="false" name="DynamicContentPreview" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer" />

This does not look correct. The assembly should be Framework.AspNet. again on phone, can't check for sure :) 

#193586
May 31, 2018 18:40
Vote:
 

Quan, you are magnificent, that was it.  However I have a new issue remote event binding that you may be able to help with, i'll start a new topic :)

For those that this may help.....

change this:

<add showInFileManager="false" virtualName="DynamicContentPreview" virtualPath="~/Edit/Dialogs/DynamicContentPreview.aspx" bypassAccessCheck="false" name="DynamicContentPreview" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer" />

To this:

<add showInFileManager="false" virtualName="DynamicContentPreview" virtualPath="~/Edit/Dialogs/DynamicContentPreview.aspx" bypassAccessCheck="false" name="DynamicContentPreview" type="EPiServer.Web.Hosting.VirtualPathMappedProvider, EPiServer.Framework.AspNet" />

#193589
May 31, 2018 19:00
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.