C# The request was aborted: Could not create SSL/TLS secure channel. - C#

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                    | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

https://stackoverflow.com/questions/62138177/the-request-was-aborted-could-not-create-ssl-tls-secure-channel-c-sharp

但是发现在.net Framework 4.0 中没有
http://www.voidcn.com/article/p-qctsmyjp-bys.html

在Framework 4.0上,如果要允许TLS 1.0,1.1和1.2,只需替换:

SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12

通过:

(SecurityProtocolType)(0xc0 | 0x300 | 0xc00)
posted @ 2020-11-30 14:18  LuoCore  阅读(370)  评论(0编辑  收藏  举报