我有一个ASP.NET MVC 4项目,我需要更新才能使用Lucene 3.0。我需要手动设置框架以使用.NET Framework 4.5,因为我使用的是需要此版本的最新Windows Azure库。除非我使用Entity Framework添加新数据模型,否则一切正常。我可以使用Entity Framework成功添加新的数据模型。但是,当我尝试执行基本存储过程(它只执行查询)时,我得到一个运行时异常。例外是:
System.Reflection.ReflectionTypeLoadException
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
当我查看LoaderExceptions属性时,我看到以下内容:
[0] {"Could not load file or assembly 'Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181"} System.Exception {System.IO.FileLoadException}
[1] {"Could not load file or assembly 'Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181"} System.Exception {System.IO.FileLoadException}
奇怪的是,我无法在任何地方找到Lucene.Net版本2.9.4.1的单一引用。我在我的应用程序中引用了Lucene.Net的3.0.3.0版本。有人能告诉我文件的2.9.4.1版本会被引用吗?我查看过以下几个地方:
MyProject.csproj
Web.config
Global.asax.cs
packages.config
我该如何解决这个问题?我已经在这上面打了2天。它太奇怪了。非常感谢您提供的任何帮助。
答案 0 :(得分:1)
我知道这个问题的答案并不完全正确,但如果真的让你感到困扰(并且你很幸运,这两个版本是兼容的)你可以将任何2.9.4.1的请求重定向到你所拥有的版本将绑定重定向添加到配置文件中。