我试图让 SQLite 与 Elmah 一起工作,但它一直在抱怨附加的版本。
我已经阅读了许多关于该主题的博客,但到目前为止,没有一种推荐的方法对我有用。
Elmah.MVC 已经安装,作为在 NUGET 中找到的最新版本,然后安装了 SQLite 核心框架,按照 NUGET 中的当前版本也是如此。
据我所知,NUGET 将 SQLite 条目附加到 web.config 文件中的方式是这样,但我看不出有什么区别。
我的 packages.config(为便于阅读而省略了条目):
<?xml version="1.0" encoding="utf-8"?>
<packages>
.....
<package id="elmah.corelibrary" version="1.2.1" targetFramework="net45" />
<package id="Elmah.MVC" version="2.1.1" targetFramework="net45" />
<package id="System.Data.SQLite" version="1.0.94.1" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
<package id="System.Data.SQLite.EF6" version="1.0.94.0" targetFramework="net45" />
<package id="System.Data.SQLite.Linq" version="1.0.94.1" targetFramework="net45" />
.....
</packages>
Elmah 已实现为视图/控制器,而不是预定义的标准 .axd 版本,因此当我浏览http://localhost:3812/Elmah/时,会抛出以下堆栈跟踪:
Could not load file or assembly 'System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' 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 'System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
和Pre-bind state information
=== Pre-bind state information ===
LOG: DisplayName = System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
(Fully-specified)
LOG: Appbase = file:///C:/Users/Admin/Documents/Visual Studio 2015/Projects/TestMvc/Site/TestMvc.WebSite/
LOG: Initial PrivatePath = C:\Users\Admin\Documents\Visual Studio 2015\Projects\TestMvc\Site\TestMvc.WebSite\bin
Calling assembly : Elmah, Version=1.2.14318.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Admin\Documents\Visual Studio 2015\Projects\TestMvc\Site\TestMvc\web.config
LOG: Using host configuration file: C:\Users\Admin\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: System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
LOG: Attempting download of new URL file:///C:/Users/Admin/AppData/Local/Temp/Temporary ASP.NET Files/root/65395abf/3be698df/System.Data.SQLite.DLL.
LOG: Attempting download of new URL file:///C:/Users/Admin/AppData/Local/Temp/Temporary ASP.NET Files/root/65395abf/3be698df/System.Data.SQLite/System.Data.SQLite.DLL.
LOG: Attempting download of new URL file:///C:/Users/Admin/Documents/Visual Studio 2015/Projects/TestMvc\Site\TestMvc/bin/System.Data.SQLite.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
我认为这不是 Visual Studio 2015 CTP 的问题,也不是最新版本的 Elmah.MVC 或 SQLite 或构建属性(任何 CPU 与 x86/x64),因为 SQLite 在针对数据库(此问题中未显示)。
任何帮助将不胜感激。