无法加载文件或程序集“Spring.Core,......”(Could not load file

2019-09-28 19:03发布

下面如下产生的错误:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not load file or assembly 'Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
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 'Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07' could not be loaded.

=== Pre-bind state information ===
LOG: User = eggtech024-PC\eggtech024
LOG: DisplayName = Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07
 (Fully-specified)
LOG: Appbase = file:///C:/Users/eggtech024/documents/visual studio 2010/Projects/SpringNet.NHibernate.Fluent/SpringNet.NHibernate.Fluent.Web/
LOG: Initial PrivatePath = C:\Users\eggtech024\documents\visual studio 2010\Projects\SpringNet.NHibernate.Fluent\SpringNet.NHibernate.Fluent.Web\bin
Calling assembly : Spring.Web, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\eggtech024\documents\visual studio 2010\Projects\SpringNet.NHibernate.Fluent\SpringNet.NHibernate.Fluent.Web\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/db1ef6cb/60726545/Spring.Core.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/db1ef6cb/60726545/Spring.Core/Spring.Core.DLL.
LOG: Attempting download of new URL file:///C:/Users/eggtech024/documents/visual studio 2010/Projects/SpringNet.NHibernate.Fluent/SpringNet.NHibernate.Fluent.Web/bin/Spring.Core.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

堆栈跟踪:

[FileLoadException: Could not load file or assembly 'Spring.Core, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   Spring.Context.Support.WebSupportModule..cctor() in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Web\Context\Support\WebSupportModule.cs:125

[TypeInitializationException: The type initializer for 'Spring.Context.Support.WebSupportModule' threw an exception.]
   Spring.Context.Support.WebSupportModule..ctor() +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) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.Configuration.HttpModulesSection.CreateModules() +187
   System.Web.HttpApplication.InitModules() +28
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327

Answer 1:

冲刷你有充分的项目,并确保你所引用的所有的人都和它的版本匹配无论是在你的web.config中定义的非常相同的弹簧DLL。 看起来你有一个DLL版本不匹配回事。



文章来源: Could not load file or assembly 'Spring.Core, …'