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();