Unable to connect to remote server - When consuming C#webservice

Asked

Viewed 3,472 times

8

I have an application developed in C# that consumes a webservice also in C#.

In some cases (not always and not everywhere/customers) when consuming the webservice i get the following error:

Unable to connect to remote server
A connection attempt failed because the connected component did not respond correctly after a period of time or the established connection failed because the connected host did not answer meuip:80

I’ve had problems with another error (that burst on the same line) that was:

Bug description: Remote name could not be solved: 'webservices.meusite.com.br'

But I was able to solve it only by repeating the attempt in case of error.

stacktrace shows the following:

em System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   em System.Net.HttpWebRequest.GetRequestStream()
   em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   em Updater.WebServ.Servico.Metodo(Int32 Id)
   em Updater.TelaPrincipal.btTeste_click(Object sender, EventArgs e)

The most intriguing of all is that no matter how many times I try here, it never fails. The problem is only in some places.

What could be causing this?

  • What is the Statuscode returned in Sponse? Statuscode indicates if the problem is on the client or server.

  • I believe it is problem in the operation Timeout, already checked the connection of its customers?

  • @Tobymosque The connection I tested is pretty much the same as mine here.

  • @Renattomachado Excuse the ignorance, but where I see the Statuscode?

  • @Jéfersontas here I have an application that also makes some web accesses, and I have problems when the connection is 3G having to reconnect the modem so that it can work the service. Isn’t that the case? Your customers' web connection is done in what way?

  • @Andrewalex ADSL, the two I tested this morning had good connections. But this may have been caused by instabilities or something then.

  • Statuscode is one of the properties of your Sponse. You are using Httpclient to request?

  • @Jéfersontavares Does this depend a lot on the types of operations existing in your Webservice and the technology applied in Webservice, Cvoce uses same or WCF Webservices? in your contract there is some.

  • @Julioborges, it should be timeout then, because the information I get is small strings. For the record, I use webservices, not WCF. And, as I mentioned above, the amount of data transmitted is very small.

  • since after a few attempts you succeed, the problem is in the internet connection of your customers that is not of good quality. A software that responds properly on multiple machines cannot be the cause of the lack of response in other.

Show 5 more comments

1 answer

4


The problem should be Timeout, try to configure the Timeout keys in the key bindings of the client software configuration file.

     <basicHttpBinding>
        <binding name="WebServiceSoap"
                 closeTimeout="00:30:00"
                 openTimeout="00:30:00"
                 receiveTimeout="00:30:00"
                 sendTimeout="00:30:00"
                 allowCookies="false"
                 bypassProxyOnLocal="false"
                 hostNameComparisonMode="StrongWildcard"
                 maxBufferSize="655360"
                 maxBufferPoolSize="524288"
                 maxReceivedMessageSize="655360"
                 messageEncoding="Text"
                 textEncoding="utf-8"
                 transferMode="Buffered"
                 useDefaultWebProxy="true">
          <readerQuotas maxDepth="32"
                        maxStringContentLength="8192"
                        maxArrayLength="1638400"
                        maxBytesPerRead="40960"
                        maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

Browser other questions tagged

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