要使用 CyberSource 服务发出请求,您必须在请求中附加 .p12 证书。
经典的附加方式(CyberSource SDK):
req.ClientCertificates.Add(new X509Certificate2(@"D:\cert\cert.p12", "password1"));
这在本地或专用托管上完美运行。
问题是我们需要在 Azure 上附加 .p12 证书,这在传统方式中是不可能的。
我尝试将其放入 wwwroot/App_Data 并加载,但它不起作用,因为我们从服务器得到的错误是:
502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
我已阅读此处,如何在 azure 上使用 cert(将 p12 更改为 pfx 并上传到 Azure): https://azure.microsoft.com/en-gb/blog/using-certificates-in-azure-websites-applications/
但我不确定这是正确的方法。
最佳答案
我已通过将证书上传到 Azure 并将其用作指纹来解决此问题。您必须在 web.config 中使用指纹才能在网站上使用它。
阅读此内容: https://azure.microsoft.com/en-gb/blog/using-certificates-in-azure-websites-applications/
关于c# - Azure 上的 CyberSource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32759181/