I'm trying to do a web request from a webpage and I'm having problem on production server.
The web application is a intranet web site with this configuration on web.config:
<authentication mode="Windows" />
I use it to get the domain user authentication.
Now I'm trying to load a web page to parse some information, I used the code below, the error appears on the second line:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
The error message is:
No connection could be made because the target machine actively refused 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 don't occur with all URLs that I have tryed, I can get the response from www.yahoo.com but not from www.google.com for example.
On my PC (Windows 7) everything allways works, I can get response from any URL using the same authentication mode (with domain controller), the problem only occur on the production server (Windows Server 2008).
Anyone has a ideia?