Http请求从测试服务器上的ASP.NET代码失败(也从IE失败...但不是Firefox!)

时间:2022-08-23 11:59:08

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

我正在从我的ASP.NET应用程序向外部服务器发送HttpRequests到例如:

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:

服务器正在运行一个服务,该服务使用xml(如Web服务)响应这些请求。我的代码发出这样的GET请求:

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:

但是在我的测试机器(旧的Windows Server 2003 64机箱)上,它失败并出现此异常:

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

System.Net.WebException:基础连接已关闭:发送时发生意外错误。 ---> System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭现有连接。 ---> System.Net.Sockets.SocketException:远程主机强行关闭现有连接

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.
  • 我可以通过将URL粘贴到浏览器来发出请求,这可以在Dev服务器上运行,但是在测试服务器上,它适用于Firefox但不适用于IE(!?!)IE提供了通用的“Internet Explorer无法显示网页“ - 如果我将IP地址更改为不存在的内容,则看起来完全相同。

  • 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).
  • 服务器由自签名SSL证书保护,该证书已添加到两个客户端(测试和开发框)上的本地计算机的可信证书存储中。但是它不太可能出现证书问题,因为它在dev上工作正常,如果忽略证书验证(在测试中)仍然会发生。

  • I can telnet to the server (with the right IP and port) from the Test box.
  • 我可以从测试框telnet到服务器(使用正确的IP和端口)。

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

任何人都可以建议尝试一下吗?可能的原因?一种缩小它的方法?

1 个解决方案

#1


2  

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

我终于在服务器的Windows事件日志中发现了一个相关的错误:

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.

从远程客户端应用程序收到TLS 1.0连接请求,但服务器不支持客户端应用程序支持的任何密码套件。 SSL连接请求失败。

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

我创建了一个新问题,实际上是一个问题,在这里:如何添加到ASP.NET HttpRequest客户端可用的密码套件?

#1


2  

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

我终于在服务器的Windows事件日志中发现了一个相关的错误:

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.

从远程客户端应用程序收到TLS 1.0连接请求,但服务器不支持客户端应用程序支持的任何密码套件。 SSL连接请求失败。

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

我创建了一个新问题,实际上是一个问题,在这里:如何添加到ASP.NET HttpRequest客户端可用的密码套件?