By sedigo


2012-11-29 08:06:15 8 Comments

I am trying to connect to mysql from a c# app using ssl. the following is my connection string:

 server = "xxx.xxx.xxx.xxx";
        database = "sqlserver";
        uid = "sqlserver";
        password = "password";
        cert_file = "client-cert.pfx";      
        string connectionString;
        connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + "; CertificateFile=" + cert_file + "; CertificatePassword=admin; SslMode=Required";

this is the error:

System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream. at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at MySql.Data.MySqlClient.NativeDriver.StartSSL() at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at

I thought the problem was my file but now i know it is not... so i am lost

1 comments

@Davin Tryon 2012-11-29 09:05:21

server = "xxx.xxx.xxx.xxx";

Most of the time, SSL certificates define a hostname pattern (e.g. *.google.com). During the SSL authentication, the hostname is verified as being from the correct domain. Using the IP address for the server will cause this check to fail.

I would try to set the hostname as server and see if you get different results.

@sedigo 2012-11-29 09:56:30

I used the hostname but i still have that error.

@sedigo 2012-11-29 10:51:04

may be the problem come from my openssl instalation. i have installed openssl 64 bit downloaded from slproweb.com/products/Win32OpenSSL.html. Do i need to include anything in visual studio as well? can that be the problem?

Related Questions

Sponsored Content

0 Answered Questions

Push notification using C# in ASP.NET MVC

3 Answered Questions

[SOLVED] System.IO.IOException: The handshake failed due to an unexpected > packet format?

  • 2011-03-03 09:21:56
  • TheLearner
  • 38018 View
  • 20 Score
  • 3 Answer
  • Tags:   c# wcf

0 Answered Questions

Error on production server

0 Answered Questions

17 Answered Questions

[SOLVED] "Debug certificate expired" error in Eclipse Android plugins

2 Answered Questions

[SOLVED] Accessing Webservice which is hosted on https server

1 Answered Questions

How do access a secure website within a sharepoint webpart?

Sponsored Content