1

I have a .Net website (not a Web Application) project running in framework version 4.6.2

My implementation of the Cybersource simple order api works correctly on the development machine. However when i deploy my website to stage or product i receive the error The system cannot find the file specified when attempting the following code below.

NVPClient.RunTransaction(_cyberSourceConfig, request);

I have checked that the keys are valid. The _cyberSourceConfig contains the correct Currency, MerchantId, KeyFile, Key Directory and the locations are valid within the file system.

Check that the following DLL's are included within the projects bin directory

I have also checked that the following DLL's are in my projects bin directory.

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

_cyberSourceConfig consists of the the following

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/";
Stig
  • 1,169
  • 1
  • 9
  • 12
  • You have to provide more information. For example what is `_cyberSourceConfig`? – Svek Jun 22 '17 at 16:36
  • @svek updated the post as requested – Stig Jun 22 '17 at 16:50
  • Did you verify that your `KeyFilename` and `KeysDirectory` are actually resolving properly? You should provide the stack trace results, I'll bet you it's going to point to this issue further down (ie. `System.IO`) – Svek Jun 22 '17 at 16:53
  • I send the keys etc to a log file before the below line is executed NVPClient.RunTransaction(_cyberSourceConfig, request); – Stig Jun 22 '17 at 17:56

2 Answers2

1

Based on your provided information, I would suspect that you are specifying a file that is resolvable on your development machine, but is not resolving properly on your staging / production server.

_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.

Svek
  • 12,350
  • 6
  • 38
  • 69
  • 150% that is not the case. 2 People have checked the file path. I have also checked the permissions on the folder and Given everyone full control on the directory just encase. – Stig Jun 22 '17 at 17:53
0

Set your App Pool to Load User Profile: True

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

That link is going to a 404 now, but the more general answer is fleshed out in this question.

CryptographicException was unhandled: System cannot find the specified file

Alex
  • 68
  • 1
  • 11