No connection can be made because the target machine actively abandoned it

I am trying to make a web request from a web page and I am having a problem on a production server.

The web application is an intranet website with this configuration on web.config:

<authentication mode="Windows" />

I use it to get domain user authentication.

Now I'm trying to load a web page to analyze some information, I used the code below, the error appears in the second line:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Error message:

It is not possible to establish a connection because the target machine has actively abandoned it. 64.233.163.104:80.

Stack trace:

[SocketException (0x274d): No connection could be made because the target machine actively refused it 64.233.163.104:80]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +269
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +649

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetResponse() +1126
   Fumagalli.Insight.Admin.Teste.Page_Load(Object sender, EventArgs e) +606
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

This error does not occur with all the URLs I tried, I can get a response from www.yahoo.com, but not from www.google.com for example.

(Windows 7) , URL-, ( ), (Windows Server 2008).

- ?

+3
2

: , -, , ,

- , - - ( ).

WebProxy webproxy = new WebProxy("http://192.168.4.8:8080");
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Proxy = webproxy;
+5

, . , . . , , HttpRequest, Google, . , Google WebAgent, HttpRequest; .NET Google . , Google DOS- .NET, GetResponse(). , , IE 8, WebAgent.

+1

Source: https://habr.com/ru/post/1770997/


All Articles