Http Request fails from ASP.NET code on Test server (also fails from IE... but not firefox!?)
Asked Answered
H

1

7

I'm making HttpRequests to an external server from my ASP.NET application, to a URL like e.g.:

https://1.2.3.4:12345/Data/Users?Id=1

The server is running a service that responds to these requests with xml (like a web service). My code makes a GET request like this:

var wc = new System.Net.WebClient();
wc.Credentials = credentials; // username and password for service

// get data from server.    
string s = Encoding.ASCII.GetString(wc.DownloadData(url));
return s;

It works fine on my Development machine.

But on my Test machine (old windows server 2003 64 box) it fails with this exception:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Googling tells me this is error has about a million different possible causes. None seem to apply.

Details:

  • I can make the request by pasting the URL into a browser, and this works on the Dev server, but on the Test server, it works on Firefox but not IE (!?!) IE gives a generic "Internet Explorer cannot display the webpage" - looks exactly the same if I change the IP address to something that doesn't exist.
  • The server is a secured by a self-signed SSL cert, which has been added to local computer's trusted certificate store on both clients (the test and dev boxes). But it's unlikely a certificate issue, since it works fine on dev, and still happens if you ignore certificate validation (on test).
  • I can telnet to the server (with the right IP and port) from the Test box.

Can anyone suggest something to try? A possible cause? A way to narrow it down a bit?

Henley answered 14/6, 2013 at 10:26 Comment(0)
H
2

I finally found a relevant error in the server's windows event log:

An TLS 1.0 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. The SSL connection request has failed.

I created a new question, an actually answerable one, Here: How to add to the cipher suites available to ASP.NET HttpRequest client?

Henley answered 17/6, 2013 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.