开发者

MySQL Connector with mod_mono and mono 2.6.7

I've been having quite a bit of trouble getting an MVC2 web application to find the MySQL connector. I am running CentOS 5.

I've installed the DLL into the GAC using the 2.0 version of the tool

$ mono /usr/local/lib/mono/2.0/gacutil.exe -i v2/mysql.data.dll
Installed v2/mysql.data.dll into the gac (/usr/local/lib/mono/gac)

I verify that it updated the GAC:

$ ls /usr/local/lib/mono/gac/MySql.Data/6.3.5.0_开发者_如何学C_c5687fc88969c44d/mysql.data.dll

I get the following error when I run the application:

Failed to find or load the registered .Net Framework Data Provider MySql.Data.MySqlClient

I created a simple command line application described here: http://www.mono-project.com/MySQL, which works under Mono and .NET on my Windows machine, but does not work on my Linux box.


As far as you added to GAC mysql.data.dll, are you sure you're referencing exactly it or maybe MySQL.Data.dll? Linux has case-sensitive file system so references in solution are too.


Good ! Just a note : you have to adapt the machine.config file according to the version of Connector/Net you downloaded (6.3.7 in my case).


There are two problems:

  1. The casing of the DLL as already mentioned.
  2. The machine.config needed to be updated. I didn't need to do this on the windows side because the MySql provider does this for you automatically.

To update your Mono machine.config files, you'll want to find your machine.config file. In the case of Cent OS, they are located in (/usr/local/etc/mono/2.0/machine.config). I just copied the stuff from my Windows .NET machine.config file to my mono one and it worked.

<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜