Problems with WCF + Mysql

1

I want to use this method, locally it works and returns what I want, when I send IIS it simply returns me on the last screen it shows error:

Within Service1.svc.cs I have this method:

 public string envioPessoa()  {

        MySqlConnection conexao = new MySqlConnection("server='mysql.engb.uni5.net'; UId='engb' ;database='engb'; password='*********';");
        MySqlCommand comando = new MySqlCommand("SELECT * FROM usuarios AS r1 JOIN (SELECT CEIL(RAND() * (SELECT MAX(id) FROM usuarios where TIPO = 'receptor' )) AS id) AS r2 WHERE r1.id >= r2.id AND TIPO = 'receptor' ORDER BY r1.id ASC LIMIT 1", conexao);
        DataTable tabela = new DataTable();
        string retorno = "";
        try
        {
            conexao.Open();
            MySqlDataReader  teste = comando.ExecuteReader();


            while(teste.Read())      
            {

                retorno = teste.GetString(2)+";"+
                teste.GetString(3)+""+
                teste.GetString(4)+";"+
                teste.GetString(5)+";"+
                teste.GetString(7)+";"+
                teste.GetString(8);
            }
        }
        catch (Exception e) { 
           Console.WriteLine("An error occurred: '{0}'", e); 
        }
        conexao.Close();

        return retorno; 

    }

In the IService1.cs interface:

    [OperationContract]
    string envioPessoa();

    
asked by anonymous 04.12.2015 / 19:52

1 answer

0

First thing I did was enable the web.config servicedebug based on this link enable service debug , from there I checked that version of my Mysql.Data was different from the server I installed the new version in it and also added it in the bin folder where the service was published:

<serviceDebug includeExceptionDetailInFaults="true" />
    
10.12.2015 / 18:31