Web Service runs but when consuming method gives error

Asked

Viewed 110 times

-1

I struggled to set up my web service on IIS. It goes up, showing the screen that WS is ok. It turns out that when I pass a parameter to it gives this error:

REQUEST ERROR
The server encountered an error processing the request. See server logs for more details.

IIS is on an AMAZON server (Cloud).

My method

public TPDV getCnpjParceiro(string cnpj)
        {
            V99_WEBEntities db = new V99_WEBEntities();
            TPDV pdv = new TPDV();
            List<string> lista = new List<string>();

            var resultado = (from _lista in db.T_PDV
                             where _lista.CNPJ == cnpj
                             join _st in db.T_CRM_StatusPDV on _lista.CNPJ equals(_st.DE_Cnpj)
                             join _sc in db.T_Script on _st.IT_Status equals((int)_sc.TipoStatus)
                             select new
                             {
                                 _lista.CNPJ,
                                 _lista.RazaoSocial,
                                 _lista.Endereco,
                                 _lista.CaminhoLogo,
                                 _lista.Bairro,
                                 _lista.Cidade,
                                 _st.IT_Status,
                                 _st.DT_TransacaoV,
                                 tecnico = _sc.TipoScript == "T" ? _sc.Script : null,
                                 central = _sc.TipoScript == "C" ? _sc.Script : null
                             }).ToList();

            foreach (var lis in resultado)
            {
                pdv.CNPJ = lis.CNPJ;
                pdv.RazaoSocial = lis.RazaoSocial;
                pdv.Endereco = lis.Endereco;
                pdv.CaminhoLogo = lis.CaminhoLogo;
                pdv.Bairro = lis.Bairro;
                pdv.Cidade = lis.Cidade;
                pdv.ScriptCentral = lis.central;
                pdv.ScriptTecnico = lis.tecnico;
            }

            return pdv;

        }

I pass the parameter like this:

meu_ip/WebServiceSuporteTecnico/SuporteTecnicoServiceWS.svc/pesquisa/um_cnpj_da_minha_base
  • Code of the method you are trying to call and the parameters passed in the call, please

  • OK, editing the question

  • With me on my machine, it works well. Only in the cloud (IIS) is it giving way

  • That service is REST? You have set the default parameter CNPJ settings? Just to test, change string cnpj for string id. If it works is configuration problem

1 answer

0


solved. The error was as follows: When I uploaded the files to IIS that is on a remote machine on Amazon, I also uploaded my web.config. The database I’m using is on the same machine. Talking to the guy who manages Amazon here at the company, he told me that the IP is not a real IP, it’s a masked IP, which points to the real IP, so that the outside world is not aware of the real IP. As he was trying to access the bank through this IP, he could not get out, because it is only a fictional IP and gave this stick. When I opened the Event Viewer from the server and saw the underlying open() error from the database, then I knew it was a problem with the connection and that was what was giving the error. Well, I took the web.config IP and changed everything to localhost, because the bank and iis are in the same physical environment, so the BD is on localhost. I did it and now it’s working.

Browser other questions tagged

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