在 APS.Net MVC 3 应用程序中,我从 PagedList 1.10 升级到 1.12,从那时起我收到以下错误消息:
Could not load file or assembly 'PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' 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 'PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 140:
Line 141: kernel.Bind<IEmailService>().To<EmailService>();
Line 142: }
Line 143: }
Line 144:}
Source File: C:\*****\App_Start\NinjectMVC3.cs Line: 142
Assembly Load Trace: The following information can be helpful to determine why the assembly 'PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' could not be loaded.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = **\**
LOG: DisplayName = PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1
(Fully-specified)
LOG: Appbase = file:///C:/*****/
LOG: Initial PrivatePath = C:\*****\bin
Calling assembly : MvcMembership, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\*****\web.config
LOG: Using host configuration file: C:\Documents and Settings\jf\My Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/b2f5bef1/b2ccbfbe/PagedList.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/b2f5bef1/b2ccbfbe/PagedList/PagedList.DLL.
LOG: Attempting download of new URL file:///C:/*****/bin/PagedList.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'PagedList, Version=1.10.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
UpDir.Web.App_Start.NinjectMVC3.RegisterServices(IKernel kernel) in C:\*****\App_Start\NinjectMVC3.cs:142
UpDir.Web.App_Start.NinjectMVC3.CreateKernel() in C:\*****\App_Start\NinjectMVC3.cs:53
Ninject.Web.Mvc.Bootstrapper.Initialize(Func`1 createKernelCallback) in c:\Projects\Ninject\Maintenance2.2\ninject.web.mvc\mvc3\src\Ninject.Web.Mvc\Bootstrapper.cs:61
UpDir.Web.App_Start.NinjectMVC3.Start() in C:\*****\App_Start\NinjectMVC3.cs:35
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
WebActivator.BaseActivationMethodAttribute.InvokeMethod() +221
WebActivator.ActivationManager.RunActivationMethods() +491
WebActivator.ActivationManager.RunPreStartMethods() +28
WebActivator.ActivationManager.Run() +55
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9087676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
我不明白这是从哪里来的,因为我的 Web.config 文件中有以下几行:
<dependentAssembly>
<assemblyIdentity name="PagedList" publicKeyToken="abbb863e9397c5e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.12.0.0" newVersion="1.12.0.0" />
</dependentAssembly>
我以为这会解决它。我还尝试清空 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root 并重新启动我的机器,但它没有帮助。
我在错误报告中注意到调用 PagedList.dll 的是 MvcMembership.dll,但我不知道它在哪里指定加载 1.10 版本。
接下来我可以尝试什么?