Cyber​​source 简单订单 Api。系统找不到指定的文件错误信息

Cybersource Simple Order Api. The system cannot find the file specified Error Message

我在框架版本 4.6.2

中有一个 .Net 网站(不是 Web 应用程序)项目 运行

我对 Cyber​​source 简单命令的实现 api 在开发机器上运行正常。但是,当我将我的网站部署到阶段或产品时,我收到错误消息系统找不到在尝试下面的代码时指定的文件。

NVPClient.RunTransaction(_cyberSourceConfig, request);

我已检查密钥是否有效。 _cyberSourceConfig 包含正确的货币、MerchantId、密钥文件、密钥目录,并且位置在文件系统中有效。

检查项目 bin 目录中是否包含以下 DLL

我还检查了以下 DLL 在我的项目 bin 目录中。

CyberSource.Base.dll
CyberSource.Clients.dll
CyberSource.Clients.xml

_cyberSourceConfig 由以下内容组成

private CyberSource.Clients.Configuration _cyberSourceConfig = new CyberSource.Clients.Configuration();
_cyberSourceConfig.ConnectionLimit = -1;
_cyberSourceConfig.KeyFilename = "setting for key file"
_cyberSourceConfig.KeysDirectory = "path to keys directory"
_cyberSourceConfig.MerchantID = "My merchant id"
_cyberSourceConfig.SendToProduction = false;
_cyberSourceConfig.ServerURL = "https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor/";

根据您提供的信息,我怀疑您指定的文件可在您的开发机器上解析,但在您的暂存/生产服务器上无法正确解析。

_cyberSourceConfig.KeyFilename = @"keys.foo";
_cyberSourceConfig.KeysDirectory = @"C:\KeysDirectory\MyKeys\"; // <-- are you sure?

You need to make sure that either the relative or absolute paths are the same or are resolving to the file properly when using different enviornments.

将您的应用程序池设置为加载用户配置文件:正确

http://www.daves-blog.net/post/2014/06/16/X509Certificate-The-System-cannot-find-the-file-specified.aspx

link 现在将变成 404,但更笼统的答案在这个问题中得到了充实。

CryptographicException was unhandled: System cannot find the specified file