Reputation: 437
I'm developing a windows service, that downloads images from a specific URL. The service runs correctly on my computer but when I install it in the server it does not download the image and it gives the following error:
System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 212.100.220.117:80
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
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.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadData(Uri address)
at System.Net.WebClient.DownloadData(String address)
What might be causing the error and how can I resolve it? I read this page: http://support.microsoft.com/kb/318140
I'm not sure if this is the problem, and if it is what proxy should I write in the config. Asking you for your advice.
Upvotes: 9
Views: 130263
Reputation: 106
If you are working, this could indicate that you aren't connected to your VPN.
Upvotes: 3
Reputation: 1
In my case I had to modify the Logon settings of the Windows Service in the Windows Service console then used domain administrator account to run the service instead of the regular Local System/Service account then It started working properly.
Upvotes: 0
Reputation: 144
In this case it might be possible that port 80 is not open. Create an inbound and outbound rule in firewall setting to open port 80. Still, if the issue exists try with disabling the antivirus, It might be possible that antivirus is blocking the port.
Upvotes: 1
Reputation: 437
I found the answer. I was trying to access the public address "http://mywebsite.com/images/" from the server. Instead of that I used the local IP of the server hosted the website and it's now working.
Upvotes: 4