问题描述
我有一个带有IIS 7的Windows 2008服务器,它使用.NET C#应用程序向PayPal发送请求以处理付款。几个月前,我安装了一个由Verisign购买的证书。安装后,我能够运行我的WebClient代码以成功创建SSL连接,并通过PayPal NVP API(名称值对)处理付款。
最近,我在SSL交易期间收到错误。具体错误如下:
无法创建SSL / TLS安全通道
我已经检查了我可以想到的一切,并阅读StackOverflow和网络上的其他地方的许多文章。
我发现的最好的资源是: p>
请求已中止:无法创建SSL / TLS安全通道
查找本文中的错误有什么帮助调试问题?
我认为SSL会工作与否,它没有轴承/依赖于PayPal在所有...但我可能是错误的。
我觉得我应该能够使用名称值对URL是由WebClient类,并通过管道通过IE发送,并接收响应。
非常感谢你看看。
我想有一个机会,问题不是在您的客户端证书,而是在PayPal之一。
您的问题:
不,这意味着PayPal的服务器证书由您的浏览器,即PayPal的证书由作为您的证书颁发机构添加的人签名。但是,PayPal的证书不会添加到您的信任的证书。
我注意到,PayPal的当前证书的有效期从2011年3月23日。可能在那之前您的应用程序正在工作,现在应用程序已更改,应用程序已停止工作。
基于此,我建议尝试安装PayPal自己的证书作为服务器证书。
I have a Windows 2008 Server with IIS 7 which using a .NET C# Application to send requests to PayPal to process payments. A few months ago I installed a Certificate which was purchased by Verisign. After installation, I was able to run my WebClient code to create SSL Connections successfully, and process payments via the PayPal NVP API (Name Value Pair).
Recently, I have been receiving an error during SSL Transaction. The specific error is as follows:
Could not create SSL/TLS secure channel
I've checked everything I could think of, and read many articles on StackOverflow and other places on the net.
The best resource I found was this:
The request was aborted: Could not create SSL/TLS secure channel
Lookup the error in this article http://support.microsoft.com/kb/915599 Resolution J. It also may be that you are not supplying a client certificate. Most likely this is an issue with TLS or SSL3 being used and the server not understanding it.
And here is a list of all the other resources I've tried reading and implimenting their solutions:
Various Links I've Tried:
http://support.microsoft.com/kb/901183
Could not create SSL/TLS secure channel - Could the problem be a proxy server?
The request was aborted: Could not create SSL/TLS secure channel
http://forums.iis.net/t/1156690.aspx
I have tried the following solutions:
- Reinstall the certificate, and placed it into various stores (Personal, LocalComputer)
Added this ServiceManager code:
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
Enabled logging to gain more verbose details
- Various other solutions listed in the above links
What is so frustrating is that this was working fine a few months ago, and now I receive this error. At first, I thought the cert expired, but it appears to be fine.
It could be a Service Pack or Hotfix for Windows Server has created a new setting or scenario which breaks SSL. I figured that re-installing the cert would solve that.
It is important to note that when I reinstalled, I simply added it to the various stores (Double Click the cert and install). I did not create a "Certificate Request". Since its already installed and bound to the SSL Port of my IIS Application, it should be ok.
This is the code that creates the web request:
public static Hashtable DoWebReq(string strNVP, string strNVPSandboxServer)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
string _strNVP = strNVP;
//Create web request and web response objects, make sure you using the correct server (sandbox/live)
var wrWebRequest = (HttpWebRequest)WebRequest.Create(strNVPSandboxServer);
wrWebRequest.Method = "POST"; // POST
var requestWriter = new StreamWriter(wrWebRequest.GetRequestStream());
requestWriter.Write(_strNVP);
requestWriter.Close();
// Get the response.
var hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();
var responseReader = new StreamReader(wrWebRequest.GetResponse().GetResponseStream());
//and read the response
string responseData = responseReader.ReadToEnd();
responseReader.Close();
string result = System.Web.HttpContext.Current.Server.UrlDecode(responseData);
string[] arrResult = result.Split('&');
Hashtable htResponse = new Hashtable();
string[] responseItemArray;
foreach (string responseItem in arrResult)
{
responseItemArray = responseItem.Split('=');
htResponse.Add(responseItemArray[0], responseItemArray[1]);
}
return htResponse;
}
Here are a collection of screen shots to show the various components of the SSL Machine:
This is the SSL Binding Settings in IIS:
Here is an overview of the installed Certs:
This is the Error I receive:
Certs Installed:
Certificate Details
Any advice on fixing this error would be most appreciated. Some possibilities I've considered but not addressed are:
- Could the request be taking too long? It seems fast enough... but I've read this could be a problem.
- In Internet Explorer, I do see the Green "SSL Bar" which shows this site is verified as being secure. This tells me the Cert is installed correctly, is this true?
- Is there a simple test I can perform with a HTTP request of some kind to help narrow down the source of the problem?
- Could this have anything to do with PayPal? Is it possible paypal is rejecting the request due to credentials on their end?
- Would implementing an ICertificatePolicy Interface be of any help in debugging the issue? I'm hoping I can just fix it.
I would think that either the SSL would work or not, it has no bearing/dependency on PayPal at all... but I could be wrong.
I feel like I should be able to just use the Name Value Pair URL which is built by the WebClient class, and send that over the pipe via IE and receive a response.
Thank you very much for taking a look.
I think there is a chance that the problem is not in your client certificate, but in the one of PayPal.
On your question:
No, this means that the server certificate of PayPal is verified by your browser, i.e. the PayPal's certificate is signed by someone added as you certification authority. However, the PayPal's certificate is not added to your trusted certificates.
I noticed also, that PayPal's current certificate has validity from 23.3.2011. Maybe until then your application was working, and now that it was changed the application has stopped working.
Based on this I recommend trying to install PayPal's own certificate as a server certificate.
这篇关于SSL失败 - 当使用HttpWebRequest与客户端证书时收回SSL / TLS异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!