开发者

MySQL Connector/Net with SSL from WCF Service fails

I'm trying to achieve the following with no success so far:

Certificate based SSL connection to an external MySQL database (v5.0) from my WCF service (hostet in IIS 7.5 on Server 2008 R2) using Connector/Net.

The guys that host the mysql db have sent me three .pem files, which I combined to a single .pfx using OpenSSL, as described in Using SSL with MySQL Connector/Net.

But when I tried to connect using the file-based approach, I got an exception that told me that mysql 5.0 doesn't support file-based mode.

So I was left with but one option: store-based certificate.

Therefore I installed the certificate on the server (hosting my wcf service) for "Local Computer", adding it to "Personal Certificates". Then after adjusting the connection string to contain

"SSL Mode=Required;Certificate Store Location=LocalMachine;"

I tested again, with some weired authent开发者_C百科ication/credential errors.

After google'ing some more, I found that there might be a problem with insufficient access rights to the certificate. So I followed the steps explained here, and used the tool WinHttpCertCfg to grant access for the account "NetworkService", which I believe is used for hosting my service.

Unfortunately I still get the following exception:

Message: Out of sync with server
Source: MySql.Data
Type: MySql.Data.MySqlClient.MySqlException
StackTrace:
   bei MySql.Data.MySqlClient.NativeDriver.ReadOk(Boolean read)
   bei MySql.Data.MySqlClient.NativeDriver.AuthenticateNew(Boolean reset)
   bei MySql.Data.MySqlClient.NativeDriver.Authenticate(Boolean reset)
   bei MySql.Data.MySqlClient.NativeDriver.Open()
   bei MySql.Data.MySqlClient.Driver.Open()
   bei MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   bei MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   bei MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   bei MySql.Data.MySqlClient.MySqlPool.GetConnection()
   bei MySql.Data.MySqlClient.MySqlConnection.Open()
   bei System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   bei AtlasService.AtlasService.getChildNodes(UInt32 nid, Language lang, Boolean withEmpty, DateFormats format)

Does anyone know what the problem is here, or what I'm doing wrong? Any help would be greatly apreciated. Thanks in advance

/EDIT: I should add that I successfully tested the ssl connection using mysql commandline tool and workbench (with the separate .pem files)


Ok after hours of frustration I found a solution.
It seems that there is a problem with the latest version (v6.4.3) of the connector/net lib or the combination of ssl with the versions of connector/net lib and mysql server in use.

After downgrading the connector/net lib to v6.3.7 everything works fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜