November Happy Hour will be moved to Thursday December 5th.

EPiServer.ServiceLocation.StructureMap Issue. StructureMap version is 4.5.3.0

Vote:
 

Server Error in '/' Application.

Could not load file or assembly 'EPiServer.ServiceLocation.StructureMap, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

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.IO.FileLoadException: Could not load file or assembly 'EPiServer.ServiceLocation.StructureMap, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Source Error: 

Line 33: 
Line 34:             DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));
Line 35:         }
Line 36: 
Line 37:         /// 


Source File: E:\TFS_Repository\PR61795_CMS11\Dalziel.Web\Src\Dalziel.Web\Business\Initialization\DependencyResolverInitialization.cs    Line: 35 

Stack Trace: 

[FileLoadException: Could not load file or assembly 'EPiServer.ServiceLocation.StructureMap, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)]
   Dalziel.Web.Business.Initialization.DependencyResolverInitialization.ConfigureContainer(ServiceConfigurationContext context) in E:\TFS_Repository\PR61795_CMS11\Dalziel.Web\Src\Dalziel.Web\Business\Initialization\DependencyResolverInitialization.cs:35
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +55
   EPiServer.Framework.Initialization.Internal.ModuleNode.ConfigureContainer(ServiceConfigurationContext context) +150
   EPiServer.Framework.Initialization.InitializationEngine.ConfigureCurrentModules(Boolean final) +248
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +162
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +435
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +187
   EPiServer.Global..ctor() +83
   Dalziel.Web.Global..ctor() +37
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\d6c9aafc\5ce8b2cd\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) +79
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +294
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +333

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +124
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +700
#189935
Mar 27, 2018 16:09
Vote:
 

stupid question, but I assume that you do have SM packages as well (and version redirects just in case)?

what about if you enable fushion log and see what's exactly is failed (which dependency)?

#189937
Mar 27, 2018 16:22
Vote:
 

I believe I had this same issue when I updated CMS 10 to 11. The problem was that the old version of structuremap was still in bin or that the project was still actually referencing the old versions.

  • In Visual Studio run clean solution
    • check that your bin folder is empty, if not delete everything from the bin folder

Check your packages.config file, there should be only three entries that have structuremap in the package name:

<package id="EPiServer.ServiceLocation.StructureMap" version="2.0.1" targetFramework="net471" />
<package id="StructureMap" version="4.6.1" targetFramework="net471" />
<package id="structuremap.web" version="4.0.0.315" targetFramework="net471" />

(my version is the latest structuremap)

Check your project 'References'. You should only have these:

  • EPiServer.ServiceLocation.StructureMap version 2.0.1.0
  • StructureMap version 4.6.1.0 (or in your case version 4.5.3.0)
  • StructureMap.Web version 1.0.0.0

If you have the old stucturemap versions as referenced you should delete those references and re-install the structuremap packages if needed (the old versions are something like this 3.1.9.463 and 3.1.6.186)

#189944
Edited, Mar 27, 2018 20:48
Vote:
 
<p>@Antti, if you now are talking about this... seems like smth similar is flashing in my memory. if you are just upgrading epi, old obsolete SM packages are not removed, but instead - new ones required are added, resulting is conflict which gentelmen might be experiencing here.</p>
#189945
Mar 27, 2018 22:09
Vote:
 

@Valdis yes talking about the old structuremap packages not removed and after sleeping over this my memory serves me also better about the issue ;)

@Dipak, go to package manager GUI in Visual Studio and check there that if you have those old structuremap related packages then uninstall those and install the new episerver structuremap package.

Structuremap 2.0.0 was introduced in the Episerver update 191. And Johan Björnfot blogged about the update issue and what manual steps are needed.

#189952
Edited, Mar 28, 2018 5:38
Vote:
 
<div class="blockQuote"> <div class="borderBottom"><a href="/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2018/3/episerver.servicelocation.structuremap-issue.-structuremap-version-is-4.5.3.0/reepiserver-servicelocation-structuremap-issue--structuremap-version-is-4-5-32-0/">Antti Alasvuo said:</a></div> <p>I believe I had this same issue when I updated CMS 10 to 11. The problem was that the old version of structuremap was still in bin or that the project was still actually referencing the old versions.</p> <ul> <li>In Visual Studio run clean solution <ul> <li>check that your bin folder is empty, if not delete everything from the bin folder</li> </ul> </li> </ul> <p>Check your packages.config file, there should be only three entries that have structuremap in the package name:</p> <pre class="brush:xml;auto-links:false;toolbar:false" contenteditable="false"> </pre> <p>(my version is the latest structuremap)</p> <p>Check your project 'References'. You should only have these:</p> <ul> <li>EPiServer.ServiceLocation.StructureMap version 2.0.1.0</li> <li>StructureMap version 4.6.1.0 (or in your case version 4.5.3.0)</li> <li>StructureMap.Web version 1.0.0.0</li> </ul> <p>If you have the old stucturemap versions as referenced you should delete those references and re-install the structuremap packages if needed (the old versions are something like this&nbsp;<span>3.1.9.463 and&nbsp;3.1.6.186)</span></p> </div> <p>I did this as per your suggestion, but unfornutely no luck.! Error is still persist.</p>
#189956
Mar 28, 2018 10:33
Vote:
 

Dipak can you clarify a bit. So you had the old structuremap assemblies or not? If yes, did you read the Johan blog article? If you know look at the assembly versions for structuremap assemblies in you bin folder are those the ocrrect new version? What about your web.config binding redirects for structuremap assemblies?

#189957
Mar 28, 2018 10:38
Vote:
 

In Bin folder 
StructureMap.dll [4.5.1.0]
StructureMap.Web.dll [1.0.0.0]
EPiServer.ServiceLocation.StructureMap.dll [2.0.0.0]

There is no other dll related to structure map.

Web.Config 

<dependentAssembly>
<assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.1.0" newVersion="4.5.1.0" />
</dependentAssembly>

...

<dependentAssembly>
<assemblyIdentity name="EPiServer.ServiceLocation.StructureMap" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>

One more confusion.

packages\StructureMap.4.5.2\lib\net45\StructureMap.dll has version 4.5.1.0

Hope this will be give you some idea.

#189959
Mar 28, 2018 11:10
Vote:
 

Interesting, your original error was about the EPiServer.ServiceLocation.StructureMap 2.0.1.0 but now you show that you have version 2.0.0.0

I would just update the packages

  • EPiServer.ServiceLocation.StructureMap to version 2.0.1.0
  • Structuremap to version 4.6.1 (and structuremap.web to 4.0.0.315)

And see how it goes from there. btw, the StructureMap.web.dll displays always 1.0.0.0

#189961
Mar 28, 2018 11:29
Vote:
 

Also worth nothing is that version 2 of EPiServer.StructureMap.ServiceLocation is not signed and is using unsigned versions of StructureMap. This means that if the entries for binding redirects are correct then should publicKeyToken be null (both for EPiServer.ServiceLocation.SrtructureMap and StructureMap).

#190006
Mar 29, 2018 8:34
Vote:
 

The problem I have found that, my web project is signed one and EPiServer.ServiceLocation.StructureMap is unsigned one. This causing me issue. 

#190587
Apr 12, 2018 12:37
Vote:
 

For anyone else facing a similar issue in the future, your options are essentialy as follows

  1. don't attempt to code sign the project as your dependency (structure map is not strong named)
  2. make usage of https://github.com/dsplaisted/strongnamer to add strong naming at build time for your dependencies.

I think this post can be flagged as solved.

#190906
Apr 18, 2018 16:19
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.