(may I haved put this into the wrong forum place, so I will do it here again)
I am using mysql-connector-net-6.4.4 with Visual Studio 10 Prof.
I get the error: "Unable to connect to any of the specified MySQL hosts"
error-no: 1042 = ER_BAD_HOST_ERROR.
With "MySQL Administrator or MySQL Workbench I am able to get a connection to the database (also with MySQL Query Browser).
But in my ASP.NET Project it does not work?
That is the code I use within the C# Project:
String myConnectionString = "server=127.0.0.1;"
+ "uid=root;"
+ "Persist Security Info=True;"
+ "pwd=secret;"
+ "port=3333;"
+ "database=test;"
+ "charset=latin1;"
;
try
{
MySqlConnection conMySQL = new MySqlConnection();
conMySQL.ConnectionString = myConnectionString;
conMySQL.Open();
//later execute queries, etc
conMySQL.Close();
}
catch (MySqlException ex)
{
string sMessage = ex.Message;
}
I have referenced in my ASP.NET MVC project:
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Data\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Data.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Data.Entity\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Data.Entity.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Web\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Web.dll
After a long search I have done to program a connection with a simple WindowsForms Project and VS2010 and the same connection-code above. This has worked! I could fetch some data.
But withnin the ASP.NET MVC3 project not. I have try to put the code in Global.asax.cs in Application_Start(){...} at the very begining. But I can get figured out what is the diffence between the Windowsform-App (which works) and the ASP.NET-App (which works not).
The exact error message is:
"A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll"
"A first chance exception of type 'System.Net.Sockets.SocketException' occurred in MySql.Data.dll"
"A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll"
"WebDev.WebServer40.exe Error: 0 : Unable to connect to any of the specified MySQL hosts."
Can anyone please give me an advice, how can get I fixed this?
Maybe it is a premission problem with "WebDev.WebServer40.exe" (the internal ISS which comes with the Visual Studio)?
Thanks a lot for help. I have not found anything useful with Google.
Harald
I am using mysql-connector-net-6.4.4 with Visual Studio 10 Prof.
I get the error: "Unable to connect to any of the specified MySQL hosts"
error-no: 1042 = ER_BAD_HOST_ERROR.
With "MySQL Administrator or MySQL Workbench I am able to get a connection to the database (also with MySQL Query Browser).
But in my ASP.NET Project it does not work?
That is the code I use within the C# Project:
String myConnectionString = "server=127.0.0.1;"
+ "uid=root;"
+ "Persist Security Info=True;"
+ "pwd=secret;"
+ "port=3333;"
+ "database=test;"
+ "charset=latin1;"
;
try
{
MySqlConnection conMySQL = new MySqlConnection();
conMySQL.ConnectionString = myConnectionString;
conMySQL.Open();
//later execute queries, etc
conMySQL.Close();
}
catch (MySqlException ex)
{
string sMessage = ex.Message;
}
I have referenced in my ASP.NET MVC project:
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Data\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Data.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Data.Entity\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Data.Entity.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\MySql.Web\v4.0_6.4.4.0__c5687fc88969c44d\MySql.Web.dll
After a long search I have done to program a connection with a simple WindowsForms Project and VS2010 and the same connection-code above. This has worked! I could fetch some data.
But withnin the ASP.NET MVC3 project not. I have try to put the code in Global.asax.cs in Application_Start(){...} at the very begining. But I can get figured out what is the diffence between the Windowsform-App (which works) and the ASP.NET-App (which works not).
The exact error message is:
"A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll"
"A first chance exception of type 'System.Net.Sockets.SocketException' occurred in MySql.Data.dll"
"A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll"
"WebDev.WebServer40.exe Error: 0 : Unable to connect to any of the specified MySQL hosts."
Can anyone please give me an advice, how can get I fixed this?
Maybe it is a premission problem with "WebDev.WebServer40.exe" (the internal ISS which comes with the Visual Studio)?
Thanks a lot for help. I have not found anything useful with Google.
Harald