身份validation失败,因为远程方在从Web服务获取响应时已关闭传输流exception

我正在调用第三方服务,当我要求回复时,它会抛出一个exception

“身份validation失败,因为远程方已关闭传输流exception”。

我认为发送凭据存在问题。 我甚至尝试过提供新的凭据。 这是完整的代码

string get_url = "https://**.*******.com/com/******/webservices/public_webservice.cfc?wsdl&Method=CreateUser&SiteID=**&WSPassword=******&UserName=******"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(get_url); request.MaximumAutomaticRedirections = 4; request.MaximumResponseHeadersLength = 4; request.Credentials = CredentialCache.DefaultCredentials; //request.UseDefaultCredentials = false; //request.Credentials = new System.Net.NetworkCredential("*****", "*****"); request.ContentType = "application/x-www-form-urlencoded; charset=ISO-8859-1"; // Show the sent stream //lbl_send_stream.Text = send_stream; //lbl_send_stream.Text = get_url; // Get UserId And LoginToken From Third Party DB // ============================================== //Exception gets throwed When code hits here HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 

在此处输入图像描述

我找到了答案,这是因为我们调用的第三方Web服务不支持TLS 1.0,他们支持1.1和1.2。 所以我不得不改变安全协议。

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