簡體   English   中英

.NET HttpWebRequest HTTPS錯誤

[英].NET HttpWebRequest HTTPS Error

您好,我正在嘗試從https網站獲取數據(我不在防火牆或代理后面),但是即使接受所有證書,它也會不斷拋出System.Net.WebExceptionStatus.SecureChannelFailure並顯示以下消息:取消了請求:無法創建安全的SSL / TLS頻道...我到處都是,所以你們是我最后的機會。

   static void Main(string[] args)
            {
                RemoteCertificateValidationCallback ServerCertificateValidationCallback = delegate { return true; };
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://miyoigo.yoigo.com");
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {
                    Console.Write(reader.ReadToEnd());
                }
            }

提前致謝 ;)

嘗試打印WebException的InnerException屬性,應提供negot失敗的特定原因

Console.WriteLine("Inner Exception");
Console.WriteLine(String.Concat(e.InnerException.StackTrace, e.InnerException.Message));

該代碼對您而言對我來說完全正常。 我的猜測是您與網絡有關。 您是在代理服務器還是防火牆后面? 就像雷在評論中所說的那樣,請嘗試從瀏覽器中找到該URL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM