Xamarin Android WCF to after enter more than 10 times

Asked

Viewed 62 times

0

I have an app on Xamarin android that consumes a wcf service, when I instate the service more than 10 times the service falls and you need to restart it and when it will restart the bar you need to go through the middle to stop the service and then start charging a little more to start. I don’t know what I might be doing wrong because I always give Dysplasia() in the methods so I believe it’s not that, someone can help me please??

public void Conectar(int chaveAdministrador, string cnpjEstabelecimento, string IP, string NomeBanco)
{
    sPropriedades ws = new sPropriedades();
    ws.Url = "http//"+IP+":2704/Fontes/"
    ws.CarregarBase(chaveAdministrador, cnpjEstabelecimento, IP, NomeBanco);
}

When I run this function more than 10 times next it does not answer anymore, then I have to restart the service on the PC

This is Class Ownership in Service

ServiceContract(SessionMode = SessionMode.Allowed)]
    public interface IsPropriedades
    {
        [OperationContract]
        void CarregarBase(int chaveAdministrador, string cnpjEstabelecimento, string IP, string NomeBanco);
}

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class sPropriedades : IsPropriedades
    {
        public void CarregarBase(int chaveAdministrador, string cnpjEstabelecimento, string IP, string NomeBanco)
        {
            c_Propriedades.IP = IP;
            c_Propriedades.NomeBanco = NomeBanco;
            c_Propriedades.ChaveAdmin = chaveAdministrador;
            c_Propriedades.ChaveEmpresa = chaveAdministrador + "|1|" + cnpjEstabelecimento;
            c_Propriedades.ChaveCaixaDoTurno = c_Caixa_DB.BuscarChaveCaixaTurno();
            c_Propriedades.TurnoAberto = c_Caixa_DB.BuscarSituacaoTurno();
            c_Propriedades.Parametros = c_Parametros_DB.BuscarParametroFood();
        }
}
  • it’s hard to get an idea without seeing the code of your app and service, post your code in the question

  • First I referenced the service in the reference of the .droid. Example of the code...

  • we need to see the service code to understand the implementation... services do not "fall" so there must be some resource error stuck, objects not released, something like that in your code

  • please edit your question and put this comment on the question, such as client code, and also show the service code

  • Please enter the class code.

  • Do you need any more information? I thought it was session problem but I increased the amount in App.config and still does not respond after 10 times it seems that the service gets loaded

Show 1 more comment

1 answer

0

Problem solved! in fact the problem was on the service side which was accumulating enough database connections and were not closing properly. I fixed it and it worked !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.