我已将 paypal 集成到我的 MVC4 应用程序中。 PayPal dll 版本 1.5.0.0、NewtonJson dll 版本 6.0.0.0 起初,我在获取访问令牌时在本地主机遇到异常
Dictionary<string, string> sdkConfig = new Dictionary<string, string>();
sdkConfig.Add("mode", "sandbox");
string accessToken = new PayPal.Api.OAuthTokenCredential("MyClientId", "MySecretId", sdkConfig).GetAccessToken();
例外是
Invalid HTTP response: The request was aborted: Could not create SSL/TLS secure channel.
从 stackoverflow 我得到了修复
System.Net.ServicePointManager.Expect100Continue = true;
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.DefaultConnectionLimit = 9999;
它目前在我的本地主机上工作正常,但在 AWS Windows 实例上上传和运行时出现异常。
Retried 3 times.... Exception in PayPal.HttpConnection.Execute(). Check log for more details.
有人可以帮我吗?
更新
我已经检查过在 mochahost 服务器中上传相同的代码。它在那里也工作得很好 我的 EC2 实例是 Windows Server 2008 DataCenter,32 位,带有 IIS7
确保 TCP443 在您使用的任何弹性负载均衡器 (ELB) 上以及分配给 EC2 实例的安全组中处于打开状态。在操作系统中,确保 Windows 高级防火墙允许 TCP443。
这也可能意味着他们的 API 服务器存在问题(就像我正在输入此内容时他们现在遇到的问题一样)。可以在此处查看他们的 API 状态页面:https://www.paypal-status.com/api/product