C# 基础连接已经关闭: 发送时发生错误

在程序中获取某个https网址的源码,GetRespose()时

出现了“基础连接已经关闭: 发送时发生错误。”的错误提示。
翻了论坛后,有个仁兄说:
                //.net 4.0 设置: ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                //.net 4.5 设置: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls1.2;
 
自己写的程序,是.net4.0的
于是写了上边这句,就好了。
原因虽然没搞清楚。但体会很深。
原文地址:https://www.cnblogs.com/Andyudd/p/10101944.html