在程序中獲取某個https網址的源碼,GetRespose()時
出現了“基礎連接已經關閉: 發送時發生錯誤。”的錯誤提示。
翻了論壇后,有個仁兄說:
//.net 4.0 設置: ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
//.net 4.5 設置: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls1.2;
自己寫的程序,是.net4.0的
於是寫了上邊這句,就好了。
原因雖然沒搞清楚。但體會很深。