C# httpwebrequest訪問HTTPS鏈接時遇到這個錯誤,但是如果我開抓包工具,比如filddler2,則POST返回正常
錯誤提示的Message為:
基礎連接已經(jīng)關閉: 發(fā)送時發(fā)生錯誤。
InnerException為:
從傳輸流收到意外的 EOF 或 0 個字節(jié)。
試了網(wǎng)上的N種方法,以下是本次的解決方案:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
把網(wǎng)上找到的解決方案列一下,沒準就能解決了你的問題
以下是網(wǎng)上找到的解決方案:
1. request.ProtocolVersion = HttpVersion.Version10;
2. ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
3.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
4.換個UserAgent試試
5.在App.config中添加以下內容:
<system.net> <settings> <httpWebRequest useUnsafeHeaderParsing="true"/> </settings> </system.net>
以上這篇C# httpwebrequest訪問HTTPS錯誤處理方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持VEVB武林網(wǎng)。
新聞熱點
疑難解答