[Mono-list] ASP.NET and MySQL

Loren Bandiera lorenb at mmgsecurity.com
Fri Sep 22 12:23:08 EDT 2006


Hi,

I'm trying to get an ASP.NET application working with Mono running under
Linux. I want to use MySQL for the database so I got the MySQL
Connector/Net 1.0.7.

If I write a small command line program that just does this:

MySqlConnection conn = new MySqlConnection("Server=<ip
address>;Database=foo;User ID=test;Password=test;Pooling=false");
conn.Open ();
Console.WriteLine(conn.ServerVersion);

That works fine. It connects to the remote server and prints out the
server version (5.0.24a-log). 

However, if write a small ASP.NET form and try and execute that same
code from Page_load() it fails. This is the trace that xsp2 gives me:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the
specified MySQL hosts ---> System.Net.Sockets.SocketException: No such
host is known
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] 
  at MySql.Data.Common.StreamCreator.GetStream (Int32 timeOut) [0x00000] 
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] --- End of inner exception stack trace ---

  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] 
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionString settings) [0x00000] 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] 

I'm at a loss for why it works from the command line but not from within
an ASP page. It's the same connection string, server, etc.

Anyone seen this behavior before? Got any suggestions?

-- 
Loren Bandiera <lorenb at mmgsecurity.com>
MMG Security, Inc.



More information about the Mono-list mailing list