无法加载文件或程序集'MySql.Data, Version=6.3.6.0'

3

我完全不知所措 - 我遇到了非常奇怪的问题,甚至现在仍然不理解...我正在运行 Entity Framework 4.1、MySql 5.xx和 MySql Connector 版本为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版本的随机引用,但是我什么也没找到!
我很迷茫,一无所获。非常感谢您提供任何指导,在此先行致谢。

你可以尝试重定向程序集版本。http://msdn.microsoft.com/zh-cn/library/7wd6ex19(v=vs.71).aspx - Jay Otterbein
我忘了上面提到过我尝试过了,但没有成功 - 这太奇怪了,让我感到很烦。 - 99823
1个回答

5
您需要将提供程序库添加到Web应用程序的bin目录中,并在您的web.config文件中注册提供程序
然后,您需要在此处下载Connector .Net Mono
将Dlls放入bin文件夹中即可。

好的,我已经将MySQL DLL文件添加到我的bin目录中了,这就是你所说的库吗? - 99823
另外,我已经将 .Net Mono 连接器添加到我的 bin 目录并上传了。您所指的 provider library 是指 EDMX 文件吗?它没有被编译,所以我只是将其放在 app_code 目录中。我不确定是否需要使用 DbProviderFactories。 - 99823
好的,我的朋友 - 再更新一下 - 我已经注册了提供程序 - 但现在错误信息显示为:“无法加载文件或程序集'MySql.Data,版本=6.4.4.0”,而不是6.3.6.0 - 我认为我们可能离成功更近了! - 99823
好的 - 你给我的链接(.net mono)实际上不是6.4.4版本 - 所以我按照你的指示上传了6.4.4版本,问题得到了解决!!!非常感谢你。 - 99823

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接