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

Structuremap.web

Vote:
 

Hi,

I am installing the latest verssion of episerver cms and commerce and I am having the following error:

Could not load file or assembly 'StructureMap.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

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.FileNotFoundException: Could not load file or assembly 'StructureMap.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Stack Trace: 


[FileNotFoundException: Could not load file or assembly 'StructureMap.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
   EPiServer.ServiceLocation.Internal.StructureMapLifecycleTransformer.GetLifeCycle(ServiceInstanceScope scope) +0
   EPiServer.ServiceLocation.Internal.StructureMapConfiguredType`1.LifecycleIs(ServiceInstanceScope lifecycle) +27

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   EPiServer.ServiceLocation.Internal.<>c__DisplayClass9_0.b__0(ConfigurationBuilder ce) +175
   StructureMap.PipelineGraph.Configure(Action`1 configure) +118
   StructureMap.Container.Configure(Action`1 configure) +118
   EPiServer.ServiceLocation.Internal.StructureMapConfiguration.Add(Type serviceType, Func`2 implementationFactory, ServiceInstanceScope lifetime) +361
   EPiServer.ServiceLocation.ServiceConfigurationProviderExtensions.AddTransient(IServiceConfigurationProvider services, Func`2 implementationFactory) +66
   EPiServer.Framework.Initialization.InitializationEngine.GetServiceConfigurationContext() +139
   EPiServer.Framework.Initialization.InitializationEngine.ConfigureCurrentModules(Boolean final) +38
   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) +227
   EPiServer.Global..ctor() +103
   Shop.Web.Global..ctor() +37
   ASP.global_asax..ctor() +42

[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

We have the Epuserver.ServiceLocation.StructureMap v2.0.0 installed and also StructureMap V4.5.3 and structuremap.web v4.0.0.315.

Does anyone had this problem before?

Thanks in advance

Antonio

#187024
Jan 10, 2018 14:39
Vote:
 

Hi Antonio.

Looks like you either have a mismatch in your Web.config Assembly Redirects, or you may have an "old" assembly floating around in your /bin directory. Something seems to be looking for version 1.0.0.0 of Structuremap, which you do not have due to the use of EPiServer.ServiceLocation.StructureMap.2.0.0.0.

I would try and.. :

  1. Do a Clean Solution, and wipe the /bin directory of your web-project prior to rebuilding the solution. It ensures any assemblies left behind gets removed.
  2. Check your Web.config assembly references, and see if you have one for Structuremap redirecting to version 1.0.0.0

Let us hear if any of those suggestions helped.

/Casper Aagaard Rasmussen

#187026
Jan 10, 2018 14:49
Vote:
 
<p>Had it wrong in the web config. For some reason nuget didn't update it automatically..</p> <pre><span>&lt;</span><span>dependentAssembly</span><span>&gt;</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span>assemblyIdentity</span><span>&nbsp;</span><span>name</span><span>=</span><span>"</span><span>EPiServer.ServiceLocation.StructureMap</span><span>"</span><span>&nbsp;</span><span>publicKeyToken</span><span>=</span><span>"</span><span>null</span><span>"</span><span>&nbsp;</span><span>culture</span><span>=</span><span>"</span><span>neutral</span><span>"</span><span>&nbsp;/&gt;</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span>bindingRedirect</span><span>&nbsp;</span><span>oldVersion</span><span>=</span><span>"</span><span>0.0.0.0-1.0.0.0</span><span>"</span><span>&nbsp;</span><span>newVersion</span><span>=</span><span>"1</span><span>.0.0.0</span><span>"</span><span>&nbsp;/&gt;</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span>dependentAssembly</span><span>&gt;</span></pre> <p>Thanks.</p>
#187028
Jan 10, 2018 15:03
Vote:
 

I hade the same problem, but the solution was not 1) or 2).

My problem was that my StructureMap-reference had a path to "..\packages\structuremap.web-signed.3.1.6.191\lib\net40\StructureMap.Web.dll"

I removed reference and added a new one to "..\packages\structuremap.web.4.0.0.315\lib\net40\StructureMap.Web.dll"

#187683
Jan 31, 2018 15:58
Vote:
 

I had the same as above and in my case it was the Chief2moro.ImageDataExtensions nuget causing the issue. So aslo needed to change the reference manually for that since it had a dependency to the signed version of structuremap.web.

#190274
Apr 06, 2018 15:37
Vote:
 

waiting for a day when we will not need to handle these kind of trivial toolng errors.. ;)

#190296
Apr 09, 2018 5:53
Vote:
 

Im to old for this!

My problem was same as empa, Reference to signed dll...

#190336
Edited, Apr 09, 2018 17:24
This thread is locked and should be used for reference only.
* 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.