Note that there are some explanatory texts on larger screens.

plurals
  1. PONo connection could be made because the target machine actively refused it?
    primarykey
    data
    text
    <p>Sometimes I get the following error while I was doing HttpWebRequest to a WebService. I copied my code below too.</p> <hr> <pre> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:80 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream() </pre> <hr> <pre><code>ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.PreAuthenticate = true; request.Credentials = networkCredential(sla); request.Method = WebRequestMethods.Http.Post; request.ContentType = "application/x-www-form-urlencoded"; request.Timeout = v_Timeout * 1000; if (url.IndexOf("asmx") &gt; 0 &amp;&amp; parStartIndex &gt; 0) { AppHelper.Logger.Append("#############" + sla.ServiceName); using (StreamWriter reqWriter = new StreamWriter(request.GetRequestStream())) { while (true) { int index01 = parList.Length; int index02 = parList.IndexOf("="); if (parList.IndexOf("&amp;") &gt; 0) index01 = parList.IndexOf("&amp;"); string parName = parList.Substring(0, index02); string parValue = parList.Substring(index02 + 1, index01 - index02 - 1); reqWriter.Write("{0}={1}", HttpUtility.UrlEncode(parName), HttpUtility.UrlEncode(parValue)); if (index01 == parList.Length) break; reqWriter.Write("&amp;"); parList = parList.Substring(index01 + 1); } } } else { request.ContentLength = 0; } response = (HttpWebResponse)request.GetResponse(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload