No connection could be made because the target machine actively refused it 127.0.0.1:8888

  • Thread starter Thread starter kapil kumar velpuri
  • Start date Start date
K

kapil kumar velpuri

Guest
Team,

I need urgent help because it’s occurring in the production environment

Below code is used to connect a external service but getting local proxy error , No proxy is enabled in the IE and Fiddler is not installed in the servers.

System.Net.Http.HttpRequestExceptionAn error occurred while sending therequest. System.Net.WebException Unable to connect to theremote server at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) System.IO.Stream EndGetRequestStream(System.IAsyncResult, System.Net.TransportContext ByRef) System.Net.Sockets.SocketException Noconnection could be made because the target machine actively refused it 127.0.0.1:8888 atSystem.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) Void InternalEndConnect(System.IAsyncResult)

// Create web request
WebRequest req = WebRequest.Create(URI);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";

byte[] data = Encoding.ASCII.GetBytes(Parameters);
req.ContentLength = data.Length;
using (Stream os = req.GetRequestStream())
{
os.Write(data, 0, data.Length);
os.Close();
}

System.Net.WebResponse resp = null;
resp = req.GetResponse();

using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
{
return sr.ReadToEnd().Trim();
}

Continue reading...
 
Back
Top