我正在製作一個asp.net網頁表單應用程序,該應用程序提供使用paypal付款。該應用程序應該使用ssl。當我運行我的應用程序一切順利,直到我選擇我的按鈕paypal支付。當我按下這個按鈕,會出現以下錯誤:HttpWebRequest:請求已中止:無法創建SSL/TLS安全通道
The request was aborted: Could not create SSL/TLS secure channel.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
Source Error:
Line 203: Line 204: //Retrieve the Response returned from the NVP API call to PayPal. Line 205: HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); Line 206: string result; Line 207: using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
Source File: C:\Users\willem\documents\visual studio 2015\Projects\WingtipToys\WingtipToys\Logic\PayPalFunctions.cs
Line: 205
下面我的方法,其中錯誤ocurs
public string HttpCall(string NvpRequest)
{
string url = pEndPointURL;
string strPost = NvpRequest + "&" + buildCredentialsNVPString();
strPost = strPost + "&BUTTONSOURCE=" + HttpUtility.UrlEncode(BNCode);
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Timeout = Timeout;
objRequest.Method = "POST";
//objRequest.ContentLength = strPost.Length;
try
{
using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
{
myWriter.Write(strPost);
}
}
catch (Exception)
{
// No logging for this tutorial.
}
//Retrieve the Response returned from the NVP API call to PayPal.
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
string result;
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
}
return result;
}
您是否安裝了調用端點所需的SSL證書? – Elmar
我相信我在Windows時問我:你想信任IIS Express SSL證書並繼續?然後:你想安裝這個證書嗎?我都回答是。 – WillemKoonings
我指的是您嘗試創建Web請求的端點。當您使用瀏覽器瀏覽該服務端點時,是否會向您顯示您已在工作站上本地安裝/信任的證書? – Elmar