【问题标题】:Could not load file or assembly 'MySql.Data, Version=6.3.6.0无法加载文件或程序集'MySql.Data,版本 = 6.3.6.0
【发布时间】:2012-03-02 02:50:24
【问题描述】:

我完全不知所措 - 我遇到了非常奇怪的问题,我什至还真的不明白……我正在运行 Entity Framework 4.1、MySql 5.xx 并且我的 MySql 连接器是 v 6.4.4 - 一切都在本地正常运行,但是每当我上传到我收到的服务器时:

Could not load file or assembly 'MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' 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 'MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 48:         /// Initializes a new proventradesEntities object using the connection string found in the 'proventradesEntities' section of the application configuration file.
Line 49:         /// </summary>
Line 50:         public proventradesEntities() : base("name=proventradesEntities", "proventradesEntities")
Line 51:         {
Line 52:             this.ContextOptions.LazyLoadingEnabled = false;


Source File: e:\web\proventrade\htdocs\App_Code\ProvenTrades.Designer.cs    Line: 50

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

我很困惑,我很肯定我的 Bin 目录中有 MySql 6.4.4 dll,而且我的 Web.config 对版本​​ 6.3.6 进行了零引用 - 我已经搜索了我的整个项目(使用全局查找)对于 6.3.6 甚至只是为了 MySql 看看我是否可以找到任何随机引用这个流氓 6.3.6 版本,但我什么也没找到!

我迷路了,无处可去。非常感谢您对此提供任何指导,非常感谢。

【问题讨论】:

标签: asp.net mysql entity-framework entity-framework-4.1 mysql-connector


【解决方案1】:

您必须将提供程序库添加到 Web 应用程序的 bin 目录和 web.config 中的 register provider

那么你必须下载连接器.Net Mono here

并将 Dlls 放入 bin 文件夹中。

【讨论】:

  • 好的,我已经将 mysql dll 添加到我的 bin 目录中,这就是你所说的库吗?
  • 另外 - 我已将 .Net Mono 连接器添加到我的 bin 并上传。提供者库是指 EDMX 文件吗?它没有编译,所以我只是将它放在 app_code 目录中。我不确定是否需要使用 DbProviderFactories
  • 好的,我的朋友 - 再更新一次 - 我已经注册了提供程序 - 但是现在错误消息指出:“无法加载文件或程序集 'MySql.Data,版本 = 6.4.4.0”而不是6.3.6.0 - 我想我们可能会越来越近!
  • 好的 - 你给我的链接(.net mono)实际上不是 6.4.4 版本 - 所以我按照你的指示上传了 6.4.4 并修复了它!!!!!!非常感谢
猜你喜欢
  • 2014-01-30
  • 2023-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-19
  • 2016-12-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多