最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
C# httpwebrequest访问HTTPS错误处理方法
时间:2022-06-25 07:55:50 编辑:袖梨 来源:一聚教程网
C# httpwebrequest访问HTTPS链接时遇到这个错误,但是如果我开抓包工具,比如filddler2,则POST返回正常
错误提示的Message为:
基础连接已经关闭: 发送时发生错误。
InnerException为:
从传输流收到意外的 EOF 或 0 个字节。
试了网上的N种方法,以下是本次的解决方案:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
把网上找到的解决方案列一下,没准就能解决了你的问题
以下是网上找到的解决方案:
1. request.ProtocolVersion = HttpVersion.Version10;
2. ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
3.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
4.换个UserAgent试试
5.在App.config中添加以下内容:
代码如下 | 复制代码 |
|
相关文章
- 崩坏星穹铁道托帕突破材料一览 崩坏星穹铁道托帕突破需要哪些材料 05-02
- 庄园领主贸易系统使用指南 05-02
- 《天涯明月刀手游》2022年6月13日每日一题答案分享 05-02
- 庄园领主怎么养殖 05-02
- 失落的方舟布兰斯怎么获得 05-02
- 英雄无敌5怎么收集古代宝物 05-02