EPi CMS 7.5 to 8.0 upgrade results in structuremap exception

Vote:
 

Dear EPi-developers,

I am hoping that you are able to help us with the following issue.

We have upgraded an existing solution from EPi CMS 7.5 to 8.0. When the solution is initializing, the following error appears.

So far, our investigations show:

  • It is the upgrade-step from version 7.19.2 to 8.0.0 that results in the error. All other version upgrades does not affect the error.
  • It seems that no custom code is run before the initialization routines executes, and the error is seen.
  • If we point the solution to another content-database (a working CMS 8.x solution), the same error remains. Hence the error must be independent from the content-database.

As far as I can conclude, the error must reside in the configuration (web.config etc), but I'm eager to hear if you've seen anything like it - before we take apart the whole solution and isolates the error.

Best regards
Jonas Johansen

[StructureMapException: StructureMap Exception Code:  202
No Default Instance defined for PluginFamily EPiServer.Framework.Blobs.BlobFactory, EPiServer.Framework, Version=8.8.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   StructureMap.BuildSession.<.ctor>b__0(Type t) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:33
   StructureMap.Util.Cache`2.get_Item(KEY key) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Util\Cache.cs:83
   StructureMap.BuildSession.CreateInstance(Type pluginType) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:215
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:109
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:73
   StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:80
   lambda_method(Closure , IArguments ) +439
   StructureMap.Construction.<>c__DisplayClass2.b__0(IArguments args) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Construction\BuilderCompiler.cs:56
   StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Construction\InstanceBuilder.cs:34
   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:247
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:109
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:73
   StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ObjectBuilder.cs:30
   StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:176
   StructureMap.BuildSession.CreateInstance(Type pluginType) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:215
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +70

[ActivationException: Activation error occurred while trying to get instance of type ContentListDB, key ""]
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +181
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance() +59
   EPiServer.DataAbstraction.DefaultContentRootRepository.EnsureSystemRoots() +162
   EPiServer.DataAbstraction.DefaultContentRootRepository.Load(String rootName) +28
   EPiServer.Web.SystemDefinition.get_Current() +286
   EPiServer.Web.SiteDefinition.get_SiteAssetsRoot() +18
   EPiServer.Web.SiteDefinition.MakeReadOnly() +127

[TypeInitializationException: The type initializer for 'EPiServer.Web.SiteDefinition' threw an exception.]
   EPiServer.Web.SiteDefinition.get_Current() +0
   EPiServer.Initialization.XFormsInitialization.Initialize(InitializationEngine context) +222
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +64
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +314

[InitializationException: Initialize action failed for Initialize on class EPiServer.Initialization.XFormsInitialization, EPiServer, Version=8.8.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +855
   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +168
   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +919
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +104
   EPiServer.Global..ctor() +110
   Portal.Website.Global..ctor() +40
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\61a200d2\2c4b61c9\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) +159
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +127
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14297981
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +198
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +312
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12617668
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12457285
#122957
Jun 18, 2015 16:46
Vote:
 

It looks like it does not like something with the blob provider.

Are you using any custom or the built in file blob provider?

#122960
Jun 19, 2015 0:26
Vote:
 

Hi, do you have anything in <episerver.framework><blob> element inside either "web.config" or most probably inside "episerverframework.config" file?

#122961
Jun 19, 2015 0:31
Vote:
 

Hi, 


We use the built-in blob-provider, and there is no <episerver.framework><blob> element present in neither of our *.config-files.

Here's our episerverframework.config content:

<episerver.framework>  
  <appData basePath="\\NCSV0173-SQL\shared\vpp_virksomhedsportalen_dev" />
  <scanAssembly forceBinFolderScan="true" />
  <virtualRoles addClaims="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 name="CmsAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebAdmins, Administrators" mode="Any" />
      <add name="CmsEditors" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebEditors" mode="Any" />
      <add name="Creator" type="EPiServer.Security.CreatorRole, EPiServer" />
      <add name="PackagingAdmins" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="WebAdmins, Administrators" mode="Any" />
    </providers>
  </virtualRoles>
  <virtualPathProviders>
    <clear />
    <add name="ProtectedModules" virtualPath="~/EPiServer/" physicalPath="Modules\_Protected" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework" />
  </virtualPathProviders>
  <geolocation defaultProvider="maxmind">
    <providers>
      <add name="maxmind" type="EPiServer.Personalization.Providers.MaxMind.GeolocationProvider, EPiServer.ApplicationModules" databaseFileName="App_Data\GeoLiteCity.dat" />
    </providers>
  </geolocation>
</episerver.framework>
#122964
Edited, Jun 19, 2015 9:48
Vote:
 
<p>About the versions once more, you are upgrading to 8.0 or 8.x? From exception there is 8.8.2 version? Is it related *only* to 8.0.0.0 version and other versions are working correctly?</p>
#122967
Jun 19, 2015 12:21
Vote:
 

Hi Valdis, 

Yes, the error is taken from the EPi CMS 8.8.2 version, since I continued the upgrade steps to see if anything changed. You can replace version "8.8.2" with "8.0.0", to have an accurate picture of the problem. I admit that pasting the above version in the exception, is a bit confusing.

When debugging, I did the upgrade in small steps, and here I was able to conclude that the error appeared when upgrading from 7.19.2 (last 7.x version) to 8.0.0. Continuing the upgrade to version 8.8.2 does not affect the exception.

#122968
Jun 19, 2015 12:29
Vote:
 

What happens if you enable logging for the EPiServer? Do you see any errors regarding Blob initialization? Sounds like default FileBlobProvider may fail without noticing initialization module.

What do you see if you dump IoC container?

ServiceLocator.Current.Container.WhatDoIHave();
#122972
Jun 19, 2015 22:59
Vote:
 

Hi Valdis, 

When inspecting the log, I get:
http://pastebin.com/GJbrihkp

When emptying the IoC container with the code below, I get:
http://pastebin.com/RbQ0rhLa

As far as I see, the log does not tell much more than the error. I'm a little more unsure what to conclude on the container content dump.


<Code to provoke error and log the structuremap container content>

    public class Global : SiteBase // temp. changed from "EPiServer.Global" for debugging upgrade error
    {
        public Global() : base()
        {
            try
            {
                var letsProvokeError = new EPiServer.Global();
            }
            catch (Exception)
            {
                var container = GetPrivateField<IContainer>(ServiceLocator.Current, "container");
                Log.DebugFormat("UpgDbg:: Container content: {0}", container.WhatDoIHave());                
                throw;
            }
        }
        (. . .)
    }
}




#122974
Jun 22, 2015 9:54
Vote:
 

Hi,

Did you try to upgrade with the app-data on local hard drive instead of on network share? I know there were some upgrading problems with app data on network shares in earlier versions of EPiServer. Moving the app data to local drive before upgrade and moving it back to network share after upgrade was the work around.

#122978
Jun 22, 2015 10:57
Vote:
 

Just read there is no data migration required when going to 8.0 so I guess it's not a problem with app-data, but again, you'll never know. :)

#122981
Jun 22, 2015 11:03
Vote:
 

Dear Mattias, 

Thank you for intput on the discussion. I tried changing the:

<appData basePath="\\NCSV0173-SQL\shared\vpp_virksomhedsportalen_dev" />

to:

<appData basePath="App_data" />

but it dit not change the error. In the App_data-folder, I tried to put 3 emtpy folders: "Documents","Global", "PageFiles", and I also tried copying in a blob-folder (with blob-content) from a working EPi 8 solution. Do you think it can fail like that if the content of the VPP-folder is not as expected?

#122999
Edited, Jun 22, 2015 17:23
Vote:
 
<p>BlobFactory should be registered in FrameworkInitialization module - So I guess there are errors that make the registration fail, possible from the creation of FileBlobProvider instance or BlobFactory instance. What does this code give you?</p> <p>var fileBlobProvider = (FileBlobProvider)ProvidersHelper.InstantiateProvider(new ProviderSettings(Blob.DefaultProvider, typeof(FileBlobProvider).AssemblyQualifiedName), typeof(FileBlobProvider));</p> <p>providers.Add(fileBlobProvider);<br />var blobFactory = new BlobFactory(Blob.DefaultProvider, new BlobProvider[] { fileBlobProvider });</p> <p>Regards.</p> <p>/Q</p>
#123000
Jun 22, 2015 17:41
Vote:
 

Dear Quan,

Seems like a good experiment. The code does however execute without errors, both before and after the structuremap exception is thrown.

I use the following snippet to test:

        public Global() : base()
        {
            try
            {
                var fileBlobProvider = (FileBlobProvider)ProvidersHelper.InstantiateProvider(new ProviderSettings(Blob.DefaultProvider, typeof(FileBlobProvider).AssemblyQualifiedName), typeof(FileBlobProvider));
                var blobFactory = new BlobFactory(Blob.DefaultProvider, new BlobProvider[] { fileBlobProvider });

                var letsProvokeError = new EPiServer.Global();
            }
            catch (Exception)
            {               

                var fileBlobProvider = (FileBlobProvider)ProvidersHelper.InstantiateProvider(new ProviderSettings(Blob.DefaultProvider, typeof(FileBlobProvider).AssemblyQualifiedName), typeof(FileBlobProvider)); 
                var blobFactory = new BlobFactory(Blob.DefaultProvider, new BlobProvider[] { fileBlobProvider });

                // here the error remains and both provider and factory are defined
                throw;
            }
        }
#123007
Jun 22, 2015 21:04
Vote:
 

So I guess there is a problem that prevents FrameworkInitialization from running properly - if at all. 

Can you make sure this is present in your web.config/system.webServer/modules:

      <add name="InitializationModule" type="EPiServer.Framework.Initialization.InitializationModule, EPiServer.Framework" preCondition="managedHandler" />

Regards.

/Q

#123011
Jun 23, 2015 8:29
Vote:
 

Dear Quan, 

The entry is already present. Here is the full node (web.config/system.webServer/modules):

<system.webServer>
    (. . .)
    <modules runAllManagedModulesForAllRequests="true">
      <add name="InitializationModule" type="EPiServer.Framework.Initialization.InitializationModule, EPiServer.Framework" preCondition="managedHandler" />
      <add name="UrlRewriteModule" type="EPiServer.Web.RoutingUrlRewriteModule, EPiServer" preCondition="managedHandler" />
      <add name="ShellRoutingModule" type="EPiServer.Shell.Web.Routing.ShellRoutingModule, EPiServer.Shell" />
      <remove name="WebDAVModule" />
      <remove name="FormsAuthentication" />
      <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
      <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
      <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
    </modules>
    ( . . .)
</system.webServer>
#123021
Jun 23, 2015 9:34
Vote:
 

Hi,

Can you make sure that the problem is BlobFactory only? If yes, you can simply register the instance as Singleton in one of your InitializationModule. But it looks like your entire registration for Framework and CMS core is missing, only Shell UI is present. 

What I would suggest is to have your own implementation of InitializationModule, replace it in web.config and have a debugger/logger to see what is going on there.

Regards.

/Q

#123027
Jun 23, 2015 10:06
Vote:
 

Hi, just to verify once again before digging deeper.. This is just a speculation, but are you sure that you are not mutating IoC container later on somewhere, or maybe even swapping it out with something else? Why I'm asking is because of this line in log files for example:

2015-06-22 09:41:20.913 INFO            EPiServer.Framework.Initialization.InitializationEngine Initialize action successful for Initialize on class EPiServer.Events.EventsInitialization, EPiServer.Events, Version=8.8.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7

This module registers some interfaces (like, EventProviderService or IEventRegistry) in IoC container - even before FrameworkInitialization module (place where BlobFactory and other guys get registered) kicks in.

Interesting is that these interfaces can't be found in your container dump.

Another question, is log file dump everything EPiServer wrote? To look inside I guess we would need to have a file with "All" error level set for the logger. I can found only INFO entries. There should be more.

#123099
Jun 24, 2015 20:21
Vote:
 

Hi

I just scanned through the posts so i dont really know if u discussed the nuget version of structuremap.

When you upgrade from 7.5 you need to change the nuget package manually.

Look att this blogpost http://davidvujic.blogspot.se/2013/12/upgrading-to-episerver-75-without.html

Hope that helps.

#123449
Jul 04, 2015 23:57
Vote:
 

Jonas,

Did you ever get this resolved?  I am running into something very similiar and I am not sure what could be causing it.

Thanks,

Steve

#141883
Nov 23, 2015 21:10
Vote:
 

Sorry - never got around to wrap this up. It seemed that the custom modules that was made didn't have explicit dependencies defined. Somehow the initialization order was changed during the upgrade til version 8.0, and suddenly the dependencies were important. Defining the dependency explicitly corrected the error according to: http://world.episerver.com/documentation/Class-library/?documentId=cms/9/6816AD61 

#151358
Jul 18, 2016 14:13
* 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.