An exception of type ‘System.IO.FileLoadException’ occurred in Ninject.dll but was not >handled in user code
Additional information: Could not load file or assembly ‘System.Web.Mvc, >Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its >dependencies. The located assembly’s manifest definition does not match the assembly >reference. (Exception from HRESULT: 0x80131040)
这与此主题中讨论的问题完全相同,
Issues after installing ninject mvc 3 in mvc 5 project
但提供的解决方案对我不起作用.
我已经尝试过目标平台4.5和4.5.1,Ninject MVC3和MVC5.我也插入了这个片段
<runtime> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> </dependentAssembly> </runtime>
在Web.config文件中,没有任何影响.
问题必须在Ninject MVC3和MVC5包中.无论何时安装这些软件包,对Ninject.StandardKernel()的任何调用都会抛出异常,无论是从Global.asaxor中获取新的NinjectWebCommon.cs还是从任何其他代码片段(当然,这对于这种类型的无关紧要)异常无论如何,但在这个线程Error using Ninject with ASP.NET V4中,有人建议该错误可能与使用Global.asax将Ninject连接到应用程序有关.
我已经没想完了.有人可以帮忙吗?
添加到您的Web.config(即SportsStore.WebUI项目):<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime>
它应该与此一起工作 – > < assemblyBinding xmlns =“urn:schemas-microsoft-com:asm.v1”>