2015-09-07 14 views
7

Sto scrivendo la mia prima app per Windows 10 Universal che opera sul database MySql. Ho usato il codice da questa guida (E 'per le applicazioni Windows 8 negozio):Come connettere l'App W10 Universal con il database MySQL

https://blogs.oracle.com/MySqlOnWindows/entry/how_to_using_connector_net

Ma quando provo ad aprire la connessione con il mio database ottengo l'errore:

An exception of type 'System.NotImplementedException' occurred in >MySql.Data.RT.dll but was not handled in user code

Additional information: SSL not supported in this WinRT release.

public class DBconnector 
{ 
    static string server = "127.0.0.1"; 
    static string database = "hurtownia"; 
    static string user = "root"; 
    static string pswd = "root"; 

    public static bool login(string email, string password) 
    { 
     string connectionString = "Server = " + server + ";database = " + database + ";uid = " + user + ";password = " + pswd + ";"; 
     using (MySqlConnection connection = new MySqlConnection(connectionString)) 
     { 
      connection.Open(); 
      MySqlCommand checkLogin = new MySqlCommand("select password_hash, password_salt from users where email = \""+email+"\"",connection); 
      using (MySqlDataReader reader = checkLogin.ExecuteReader()) 
      { 
       reader.Read(); 
       string hash = reader.GetString("password_hash"); 
       string salt = reader.GetString("password_salt"); 

       bool result = passwordGenerator.compare(password, hash, salt); 

       if (result) 
        return true; 
       else 
        return false; 
      } 
     } 
    } 
} 

Quindi, la mia domanda è come risolvere il problema e connettersi correttamente al database MySql in Windows 10 Universal App.

+0

hai controllato? http://stackoverflow.com/questions/22462441/connect-windows-8-app-to-mysql –

risposta

16

Add "; SslMode = None "alla stringa di connessione

+0

Funziona anche con .NET Core, grazie. –

+0

Mi sorprende davvero che avrebbero reso SSL la modalità predefinita, considerando che le loro distribuzioni binarie non supportano SSL/TLS. Devi costruire dal sorgente per ottenere il supporto SSL/TLS. – Elkvis

0

Sono afarid la connessione SSL non è supportata dal connettore MySql WinRT. Devi disabilitare la connessione SSL dal server MySql.

Chapter 8 Connector/Net Support for Windows Store

Connector/Net RT does not support SSL connections or Windows authentication. Also, SHA256 is not currectly supported.

6.3.6.4 SSL Command Options

BTW, un altro modo alternativo per recuperare i dati da MySQL è ospitare un servizio REST: App -> Servizio Rest -> MySQL

+0

Ho disabilitato SSL in MySQL Workbench: http://i.imgur.com/blyX30t.png Ho aggiunto anche la riga skip-ssl nel file my.ini e ho ancora questo errore. –

Problemi correlati