ASP.Net无法加载文件或程序集MySql.Data

时间:2016-05-15 16:22:18

标签: mysql asp.net .net visual-studio

我有一个连接到MySQL数据库以检索数据的ASP.Net网站。我用NuGet来安装mysql.data。这样做将一个带有sql.data dll的Bin文件夹添加到我的项目中。它在我的Web配置文件中添加了一个引用。它为我的项目添加了一个packages.config。所有这一切都是我预计的假设?有了这些资源,我的网站就可以从visual studio运行了。问题是当我将其上传到服务器时,我收到以下错误:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.

Source Error: 


An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Source File: d:\DZHosts\LocalUser\bman262\www.brandonsLoginTest.somee.com\riviera horticulture\web.config    Line: 7 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.9.8.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].

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1069.1

这是说它无法找到mysql.data引用吗?我做错了什么?

以下是我在visual studio和web.config中的解决方案的一些照片

Solution

Web.config

我正在撕裂我的头发,任何帮助都会非常感激

2 个答案:

答案 0 :(得分:0)

→您必须确保在部署项目的服务器上安装了相同的版本。

→如果要部署项目的服务器是64位,则可以为此站点的应用程序池启用32位支持(如果您的dll需要32位体系结构)。

答案 1 :(得分:0)

对于使用与我类似或相同主机的任何人,如果您遇到此问题,解决方案是将项目文件转换为服务器上的应用程序。