我正在运行一个 .net 4.5 应用程序,该应用程序向仅支持 TLS 1.1 和 TLS 1.2 的外部服务器发出安全出站请求。当我从 Windows 8/8.1 主机运行该应用程序时一切正常,但在 Windows Server 2008 上是失败: “底层连接已关闭:发送时发生意外错误。”
我相信 .net 依赖底层操作系统基础设施,并且由于 Windows Server 2008 不支持 TLS 1.1 和 TLS 1.2,WebRequest 也会失败。有人可以证实吗?有什么文件可以指点我吗?
代码示例:
var request = WebRequest.Create("https://SOMEURL");
using (var response = (HttpWebResponse) request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
// read the stream
}
}
我也在设置支持的协议(protocol):
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
最佳答案
because Windows Server 2008 does not support TLS 1.1 and TLS 1.2 the WebRequest also fails.
是的,是这样的。
Any documentation to point me to?
来自 https://support.microsoft.com/en-us/kb/245030 :
Windows Server 2008 supports the following protocols:
SSL 2.0
SSL 3.0
TLS 1.0
Windows Server 2008 R2 and Windows 7 support the following protocols:
SSL 2.0
SSL 3.0
TLS 1.0
TLS 1.1
TLS 1.2
关于.net - Windows Server 2008 的 WebRequest 故障转移 TLS 1.1/1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30479973/