我在用PayPal .Net SDK。它运行良好,直到我尝试在一个‘实时’web服务器上进行测试,我将模式设置为‘安全测试-沙箱’。
<paypal>
<settings>
<!-- Replace the mode to `security-test-sandbox` to test if your server supports TLSv1.2. For more information follow README instructions.-->
<add name="mode" value="security-test-sandbox" />但是现在在C#中,代码的底线是.
// Returns APIContext object
public static APIContext GetApiContext()
{
// ### Api Context
// Pass in a `APIContext` object to authenticate
// the call and to send a unique request id
// (that ensures idempotency). The SDK generates
// a request id if you do not pass one explicitly.
var config = getConfig();
var tokenCredential = new OAuthTokenCredential(clientId, clientSecret, config);
string accessToken = tokenCredential.GetAccessToken();// this errors...throws此错误:
PayPal.PayPalException:再试一次.PayPal.HttpConnection.Execute()中的异常。查看日志以获得更多详细信息。
问题是日志没有提供任何有用的信息,只是“无法连接到远程服务器”:
2017-02-10 17:32:41,114 10调试Content-Type:application/x-www-form-urlencoded (null) PayPal.Api.PayPalResource 2017-02-10 17:32:41,130 10调试(lang=DOTNET;v=4.5.1;clr=4.0.30319.42000;bit=64;os=Microsoft PayPal.Api.PayPalResource (null)用户代理:PayPalSDK/PayPal SDK 1.8.0 Windows NT 6.3.9600.0 2017-02-10 17:32:41,130 10调试PayPal.Api.PayPalResource (null)授权:基本QVV...MT3A= 2017-02-10 17:32:41,130 10调试PayPal.Api.PayPalResource (null) PayPal.Api.PayPalResource 2017-02-10 17:32:42,594 10错误PayPal.Api.HttpConnection (null)无法连接到远程服务器 2017-02-10 17:32:42,594 10调试PayPal.Api.HttpConnection (null)连接服务器时出现问题: ConnectFailure ..。
我使用自签名证书在web服务器上设置了HTTPS和cloudflare。
安全性应该足以连接到PayPal,但我仍然无法。
我在IIS中启用了登录到FailedReqLogFiles,虽然有一个条目为失败的请求,它说“没有发现错误或警告”在日志的“错误和警告”部分。
我怎么知道出了什么问题?
发布于 2017-02-13 15:14:50
不再支持“安全-测试-沙箱”模式(自述更新)。
将模式设置为“live”或“sandbox”,就像预期的那样。
https://stackoverflow.com/questions/42165931
复制相似问题