Exception when accessing web service in application Xamarin.forms

0

I'm creating an application with Xamarin with Visual Studio 2017. I did all the tests in the web service and it accesses the database and records everything perfectly in the browser version. I have now made an implementation in the Xamarin application and in this case an exception is occurring when initializing the database. The database already exists and data is already stored in the database. I made the post using the internet information services (iis) in windows 10. The exception descriptions are below.

Message

  

System.Web.Services.Protocols.SoapException: The server was unable to   process the request. --- > System.Exception: An exception occurred   while initializing the database. See the InnerException for details.
  in ServiceWebFlipDigital.WSFlipDigital.GravarAgencia (String   jsonAgency) in C: \ Users \ davinc131 \ documents \ visual studio   2017 \ Projects \ WebServiceFlipDigital \ ServiceWebFlipDigital \ WSFlipDigital.asmx.cs: line   65 --- End of internal exception stack trace ---

Tracke

  

at   FlipDigital.Droid.Implementacoes.Dados.ImplementGravarAgencia.GravarAgencia   (System.String jsonAgency) [0x0001f] in   E: \ Projects_Xamarin \ FlipDigital \ FlipDigital \ FlipDigital.Android \ Deployments \ Data \ ImplementGravarAgencia.cs: 49   at FlipDigital.Portatil.GravarAgenciaManager.GravarAgencia   (System.String jsonAgency) [0x00001] in   E: \ Projects_Xamarin \ FlipDigital \ FlipDigital \ FlipDigital \ Portable \ SaveAgencyManager.cs: 15   at   FlipDigital.Views.FlipDigital_CadastroAgency + d__5.MoveNext   () [0x0017d] in   E: \ Projects_Xamarin \ FlipDigital \ FlipDigital \ FlipDigital \ Views \ FlipDigital_CadastroAgency.xaml.cs: 71

What might be happening and how to resolve the problem?

NO XAMARIN

Interface

public interface IGravarAgencia
{
    void GravarAgencia(string jsonAgencia);

    void ModificarAgencia(string jsonAgencia);

    Agencia ConsultarAgencia(int idAgencia);

    void RemoverAgencia(int idAgencia);

    List<Agencia> ListarAgencias();
}


public void GravarAgencia(string jsonAgencia)
    {
        DependencyService.Get<IGravarAgencia>().GravarAgencia(jsonAgencia);
    }

This is the implementation '

public void GravarAgencia(string jsonAgencia)
    {
        try
        {
            wsFlipDigital = new WebServiceFlipDigital.WSFlipDigital();
            wsFlipDigital.GravarAgencia(jsonAgencia);
        }
        catch (Exception e)
        {

            throw new Exception(e.Message);
        }
    }

NO WEB SERVICE

[WebMethod(Description = "Grava uma agencia no banco de dados.")]
    public bool GravarAgencia(string jsonAgencia)
    {
        try
        {
            Agencia ag = new Agencia();

            ag = DeserializarAgencia(jsonAgencia);
            //negocioAgencia.GravarAgencia(ag.NomeAg.ToUpper(), ag.FotoUsuario, ag.NomeDeUsuario, ag.Email, ag.Telefone, ag.Senha);
            //return true;


            if (negocioAgencia.ValidarTudo(ag.NomeAg, ag.NomeAg, ag.Telefone, ag.Email).Equals(true))
            {
                negocioAgencia.GravarAgencia(ag.NomeAg.ToUpper(), ag.FotoUsuario, ag.NomeDeUsuario, ag.Email, ag.Telefone, ag.Senha);
                return true;
            }
            else
            {
                return false;
            }
        }
        catch (Exception e)
        {
            throw new Exception(e.Message);
        }
    }

Just to remember that in the browser the process of persistence happens normally, without exceptions.

    
asked by anonymous 06.06.2017 / 16:08

0 answers