迈出实施支付网关的第一步 .
在win 8.1下的IIS 8.5中托管的ASP.net代码中调用Braintree和Beantream支付网关会导致:
“基础连接已关闭:无法为SSL / TLS安全通道 Build 信任关系”
Note that calling the same services from my middle-tier that sits on the same box works fine, so the certificate is installed properly.
以下是通过SDK调用Braintree服务的示例代码:
[System.Web.Services.WebMethod]
public static CheckinDetailResponse GetViewData()
{
CheckinDetailResponse response = new CheckinDetailResponse()
{
ClientToken = string.Empty,
IsSuccessful = false,
ErrorMessage = string.Empty
};
try
{
response.ClientToken = GetPaymentToken();
response.IsSuccessful = true;
}
catch (BaseDataServicesException ex)
{
response.ErrorMessage = ex.GetLocalizedMessage(Resources.WebCommon.ResourceManager);
}
return response;
}
private static string GetPaymentToken()
{
var gateway = new BraintreeGateway
{
Environment = Braintree.Environment.SANDBOX,
MerchantId = "999",
PublicKey = "999",
PrivateKey = "999"
};
var clientToken = gateway.ClientToken.generate(null);
return JsonDcSerialization.ToJsonString(clientToken); ;
}
是否有一些特殊设置需要在IIS中完成才能从Web应用程序调用SSL服务?
谢谢!
2 回答
如果这是从第三方证书颁发机构颁发的证书,您可能需要将签名者证书(也称为中间证书)与公钥一起传递(最终以pkcs#7格式) . 如果您使用的是自签名证书,则可能需要将根导入mmc受信任的根证书颁发机构存储区 .
我倾向于认为这是第一种情况,因为不信任的错误消息通常被称为缺乏信任链中的一块 .
希望这有帮助 .
检查计算机上是否安装了SSL证书,是否确实在代码上传递了SSL证书,以及您使用的计算机是否配置为接受证书颁发者为受信任者 .