每次尝试将我的网站上传到服务器时,我都会收到此配置错误,在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>
我已经尝试将dll复制到bin但是没有用,我删除了VS2013中的引用并重新读取,重建项目,访问GAC并从那里复制..但是没有一个有效。任何人都有关于下一步尝试的建议,下面是web配置的代码。
<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>
答案 0 :(得分:0)
不确定它是否会对您有所帮助,但我遇到了类似的问题。 右键单击mysql.data.dll上的解决方案资源管理器并选择&#34; include in project&#34;它可以在我的网络服务器上运行......(当然重新发布后)
答案 1 :(得分:0)
请确保将MySql.Data.dll
部署在项目的绑定文件夹或Web服务器的GAC中。