vb.net 无法加载文件或程序集“MySql.Data, Version=6.8.3.0”或其依赖项之一。系统找不到指定的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25179495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not load file or assembly 'MySql.Data, Version=6.8.3.0" or one of its dependencies. The system cannot find the file specified
提问by Alison Wheatley
I keep getting this Config error everytime I try and upload my website to the server, works fine on localhost
每次尝试将我的网站上传到服务器时,我都会收到此配置错误,在本地主机上运行良好
Could not load file or assembly 'MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Line 18: <compilation strict="false" explicit="true" targetFramework="4.0" debug="true">
Line 19: <assemblies>
Line 20: <add assembly="MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Line 21: <add assembly="MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Line 22: </assemblies>
I have tried copying the dll's to bin but that didn't work, i've deleted the references and readded in VS2013, rebuilt the project, access the GAC and copied from there...but none of that has worked. Anyone got any suggestions as to what to try next, code from web config is below.
我试过将 dll 复制到 bin 中,但没有奏效,我删除了引用并在 VS2013 中读取,重建项目,访问 GAC 并从那里复制......但这些都没有奏效。任何人都对下一步尝试有什么建议,来自网络配置的代码如下。
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.7.0" newVersion="6.8.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<customErrors mode="Off"/>
<compilation strict="false" explicit="true" targetFramework="4.0" debug="true">
<assemblies>
<add assembly="MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
</compilation>
<httpRuntime/>
</system.web>
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="MainConnectionString" connectionString="Server=xxxxxxx;Initial Catalog=Main;Persist Security Info=True;UID=xxxxx;Password=xxxxxxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
回答by Wexen
Not sure if it will help you but I just had a similar problem. After right clicking in the solution Explorer on the mysql.data.dll and select "include in project" it Works on my webserver... (After republishing of course)
不确定它是否会帮助你,但我刚刚遇到了类似的问题。在 mysql.data.dll 上的解决方案资源管理器中右键单击并选择“包含在项目中”后,它可以在我的网络服务器上运行...(当然是重新发布后)
回答by A.Buonanni
Be sure to have MySql.Data.dlldeployed in your project's bind folder or in the web server's GAC.
确保已MySql.Data.dll部署在项目的绑定文件夹或 Web 服务器的 GAC 中。

