问题描述
我正在使用 ASP MVC Web API 实现将网络资源实现为支付网关的注册过程.
I am implementing registration process that implements cybersource as payment gateway with ASP MVC web API.
在 web.config 中,我们必须指定密钥和日志目录.
In web.config we have to specify the keys and logs directory.
<add key="cybs.keysDirectory" value= "E:CyberSourceKeys/" />
<add key="cybs.logDirectory" value= "E:CyberSourceLogs/" />
当我们在 IIS 上部署 API 并在本地工作时,这可以正常工作.但是,当我们将 API 部署到 Azure 以及使用 CyberSource 网关的注册部分(订阅)时,我们会从请求中收到 502 bad request 错误.
This works fine when we deploy the API on IIS and work locally. But when we deploy the API to Azure and for the registration part (Subscribe) that use the CyberSource gateway we get the 502 bad request error from the request.
我们也尝试了相对路径,但仍然是同样的错误.
We tried relative paths as well but still the same error.
问题:我们认为 API 没有从密钥目录中获取 .p12 文件.
Issue: We believe that the API is not getting the .p12 file from the keys directory.
问题:将 .p12 文件放在哪里或在哪里创建密钥目录以及我们应该在 web.config 中指定什么才能使其工作.
Question: Where to put the .p12 file or where to create the keys directory and what should we specify in web.config to make it work.
推荐答案
在哪里放置 .p12 文件或在哪里创建密钥目录以及我们应该在 web.config 中指定什么以使其工作.
Where to put the .p12 file or where to create the keys directory and what should we specify in web.config to make it work.
如果您想在 Azure WebApp 中使用证书,请尝试 convert .p12 到 .pfx 并将其安装在 WebApp 中.关于如何在 Azure WebApp 中上传和使用证书,请参考这篇博客.我还找到了另一个类似的 SO 线程.
If you want to use the certificates in the Azure WebApp, please have a try to convert .p12 to .pfx and install it in the WebApp. About how to upload and use certificates in Azure WebApp, please refer to this blog. I aslo find another similar SO thread.
添加一个名为 WEBSITE_LOAD_CERTIFICATES 的应用设置,并将其值设置为证书的指纹,这样您的 Web 应用程序就可以访问它.您可以有多个以逗号分隔的指纹值,或者可以将此值设置为"*"(不带引号),在这种情况下,您的所有证书都将加载到您的 Web 应用程序个人证书存储中.
Adding an app setting named WEBSITE_LOAD_CERTIFICATES with its value set to the thumbprint of the certificate will make it accessible to your web application. You can have multiple comma-separated thumbprint values or can set this value to " * " (without quotes) in which case all your certificates will be loaded to your web applications personal certificate store.
相关链接:
Azure Web App 沙盒
这篇关于Azure、Asp.Net Mvc Web Api 中的 CyberSource 密钥文件夹问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!