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

Try our conversational search powered by Generative AI!

Episerver Commerce Upgrade to Version - 12.17.2 - Error - CommerceReportingFolder is not allowed to be created under parent of content type "SysRoot"

Vote:
 

Hi

Upon Upgrading Episerver commerce from version - 12.0.0 to 12.17.2 we are getting the following error.

Has anyone seen this error and has a resolution for this - 

Server Error in '/' Application.

Content type "CommerceReportingFolder" is not allowed to be created under parent of content type "SysRoot"

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: EPiServer.Core.EPiServerException: Content type "CommerceReportingFolder" is not allowed to be created under parent of content type "SysRoot"

Source Error:

[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\d2a0d788\d180033a\App_global.asax.0.cs    Line: 0

Stack Trace:

[EPiServerException: Content type "CommerceReportingFolder" is not allowed to be created under parent of content type "SysRoot"]
   EPiServer.Core.Internal.DefaultContentRepository.ValidateContentTypeAvailability(IContent content) +311
   EPiServer.Core.Internal.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access) +262
   EPiServer.Commerce.Reporting.Initialization.ReportingInitializationModule.CreateCommerceReportingFolder(InitializationEngine context) +307
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +58
   EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +257

[InitializationException: Initialize action failed for Initialize on class EPiServer.Commerce.Reporting.Initialization.ReportingInitializationModule, EPiServer.Commerce.Reporting, Version=12.17.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +872
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +194
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +864
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +226
   EPiServer.Global..ctor() +42
   Web.Global..ctor() +37
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\d2a0d788\d180033a\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) +142
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +107
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1476
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

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


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

Regards

Sandeeo

#266516
Nov 10, 2021 11:05
Vote:
 

FOund the solution - need to add to the root initialisation

Please add line

            setting.AllowedContentTypeNames.Add("CommerceReportingFolder");

This is need when going to version 12.6.0 or above

using BaseContentTypes.Models.Pages;
using EPiServer;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using EPiServer.DataAbstraction;

namespace Web.Business.Initialization
{
    [InitializableModule]
    [ModuleDependency(typeof(EPiServer.Data.DataInitialization))]
    public class RootPageInitialization : IInitializableModule
    {
        public const string RootPage = "SysRoot";

        public void Initialize(InitializationEngine context)
        {
            var setting = new AvailableSetting {Availability = Availability.Specific};
            var serviceLocator = ServiceLocator.Current;
            var contentRepository = serviceLocator.GetInstance<IContentTypeRepository>();

            var startPage = contentRepository.Load(typeof(StartPage));
            if (startPage == null)
            {
                return;
            }
            setting.AllowedContentTypeNames.Add(startPage.Name);

            var localizationContainer = contentRepository.Load(typeof(LocalizationContainer));
            if (localizationContainer == null)
            {
                return;
            }
            setting.AllowedContentTypeNames.Add(localizationContainer.Name);
            setting.AllowedContentTypeNames.Add("CommerceReportingFolder");

            var sysRoot = contentRepository.Load(RootPage) as PageType;
            var availabilityRepository = serviceLocator.GetInstance<IAvailableSettingsRepository>();
            availabilityRepository.RegisterSetting(sysRoot, setting); 
        }

        public void Uninitialize(InitializationEngine context)
        {

        }

        public void Preload(string[] parameters)
        {

        }
    }
}

#267285
Nov 24, 2021 9:40
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.