类型'System.IO.FileLoadException“的异常出现在Ninject.dll但在用户code没有处理 [英] An exception of type 'System.IO.FileLoadException' occurred in Ninject.dll but was not handled in user code

查看:1527
本文介绍了类型'System.IO.FileLoadException“的异常出现在Ninject.dll但在用户code没有处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面临ASP.Net MVC5本书由亚当·弗里曼。我创建了sportsStore项目为按照第七章并创建项目模板并添加引用后,我建立了项目,并尝试调试。我得到这个弹出框

如果我点击取消,我得到了这个问题提到的异常。我不能算出这个。任何建议

我得到上面的错误,当我点击取消。

下面是异常的调用堆栈 -

<$p$p><$c$c>Ninject.dll!Ninject.Modules.AssemblyNameRetriever.GetAssemblyNames(System.Collections.Generic.IEnumerable<string> ,文件名,系统predicate&LT; System.Reflection.Assembly&GT;过滤器)线路54 C#
Ninject.dll!Ninject.Modules.CompiledModuleLoaderPlugin.LoadModules(System.Collections.Generic.IEnumerable<string>文件名),81号线C#
Ninject.dll!Ninject.Modules.ModuleLoader.LoadModules(System.Collections.Generic.IEnumerable<string>图案)54号线C#
!Ninject.dll Ninject.KernelBase.Load(System.Collections.Generic.IEnumerable&LT;串GT; filePatterns)线237 C#
Ninject.dll!Ninject.KernelBase.KernelBase(Ninject.Components.IComponentContainer组件,Ninject.INinjectSettings设置,Ninject.Modules.INinjectModule []模块)线100 C#
Ninject.dll!Ninject.KernelBase.KernelBase(Ninject.Modules.INinjectModule []模块),60号线C#
Ninject.dll!Ninject.StandardKernel.StandardKernel(Ninject.Modules.INinjectModule []模块),48号线C#


  

SportsStore.WebUI.dll!SportsStore.WebUI.App_Start.NinjectWebCommon.CreateKernel()38号线C#
      Ninject.Web.Common.dll!Ninject.Web.Common.Bootstrapper.Initialize(System.Func createKernelCallback)50号线C#
      SportsStore.WebUI.dll!SportsStore.WebUI.App_Start.NinjectWebCommon.Start()第23行C#
      [外部code]
  。
  据我所知,AssemblyNameRetriever类失踪,我也尝试从GitHub上下载并使用这个类来修复它。但同样它给一些例外。如果不是Ninject本身照顾这个类的。



解决方案

看你的例外,你要加载的mvc版本的 3.0.0.0 。您正在运行不同版本的mvc

如果您有源$ C ​​$ C到依赖于旧版本的mvc项目,你可以尝试用新版本重新编译他们。您也可以尝试与依赖搞乱有全线正确的版本。

还有一个<一href=\"http://www.$c$cproject.com/Questions/705289/An-exception-of-type-System-IO-FileLoadException-o\"相对=nofollow> code项目页面用类似情况的人。 作者写道


  

审核发给我的code pes1957后,我能够确定,有的确是一个集引用错误。


  
  

的那些出现在溶液的版本5和6实体框架的引用的混合物项目基本上数目。我更新了引用,web.config文件,以显示正确的版本号和所有正确编译。


I am following the Pro ASP.Net MVC5 book by Adam Freeman. I have created the sportsStore project as per the chapter 7. And after creating the project templates and adding the references, I build the project and try to debug it. I get this pop-up box

And if I click on cancel, I get the exception mentioned in the question. I am not able to figure this out. Any suggestions

I get the above error when I click on cancel.

Here is the call stack of the exception -

Ninject.dll!Ninject.Modules.AssemblyNameRetriever.GetAssemblyNames(System.Collections.Generic.IEnumerable<string> filenames, System.Predicate<System.Reflection.Assembly> filter) Line 54   C#
Ninject.dll!Ninject.Modules.CompiledModuleLoaderPlugin.LoadModules(System.Collections.Generic.IEnumerable<string> filenames) Line 81    C#
Ninject.dll!Ninject.Modules.ModuleLoader.LoadModules(System.Collections.Generic.IEnumerable<string> patterns) Line 54   C#
Ninject.dll!Ninject.KernelBase.Load(System.Collections.Generic.IEnumerable<string> filePatterns) Line 237   C#
Ninject.dll!Ninject.KernelBase.KernelBase(Ninject.Components.IComponentContainer components, Ninject.INinjectSettings settings, Ninject.Modules.INinjectModule[] modules) Line 100  C#
Ninject.dll!Ninject.KernelBase.KernelBase(Ninject.Modules.INinjectModule[] modules) Line 60 C#
Ninject.dll!Ninject.StandardKernel.StandardKernel(Ninject.Modules.INinjectModule[] modules) Line 48 C#

SportsStore.WebUI.dll!SportsStore.WebUI.App_Start.NinjectWebCommon.CreateKernel() Line 38 C# Ninject.Web.Common.dll!Ninject.Web.Common.Bootstrapper.Initialize(System.Func createKernelCallback) Line 50 C# SportsStore.WebUI.dll!SportsStore.WebUI.App_Start.NinjectWebCommon.Start() Line 23 C# [External Code] . I understand that the AssemblyNameRetriever class is missing and I did try to fix it by downloading it from github and using that class. But again it gives some exceptions. Shouldn't the Ninject take care of this class by itself.

解决方案

Looking at your exception, you are trying to load Mvc Version 3.0.0.0. You are currently running a different Mvc version.

If you have the source code to the projects that depend on the older Mvc version, you can try to re-compile them with the newer version. You can also try messing with the dependencies to have the right version across the board.

There is also a code project page with a person with a similar situation. The author writes:

After reviewing the code pes1957 sent to me I was able to determine that there was indeed an assembly reference error.

Basically the number of projects that were in the solution had a mixture of version 5 and 6 Entity Framework references. I updated the references, and web.config to show the correct version number and all compiles correctly.

这篇关于类型'System.IO.FileLoadException“的异常出现在Ninject.dll但在用户code没有处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆