Hi All,
I am trying to access a private key file which is placed in the local folder to get connected to sftp. but I am getting the below error when running the controller class through sys operation batch. but the process is successfully getting completed when done manually. Please suggest a solution to fix this issue. The error is pasted below:
System.UnauthorizedAccessException: Access to the path ‘C:\Temp\Dixf\OpenSSh.ppk’ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs,
String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream…ctor(String path, FileMode mode,
FileAccess access, FileShare share) at System.IO.File.Open(String path, FileMode mode,
FileAccess access, FileShare share) at Renci.SshNet.PrivateKeyFile…ctor
(String fileName, String passPhrase) at Renci.SshNet.PrivateKeyFile…ctor(String fileName) at
Dynamics.AX.Application.SFTPFileOperations.SFTPConnect() in xppSource://Source/ Interface Model\AxClassSFTPFileOperations.xpp:line 30 at Dynamics.AX.Application.SFTPFileOperations.SFTPConnect() at Dynamics.AX.Application.AP_FileProcess.
run()
in xppSource://Source/Interface Model\AxClassAP_FileProcess.xpp:line 112 at Dynamics.AX.Application.AP_FileProcess.run()
at Dynamics.AX.Application.APFileProcessController.`run() in
xppSource://Source/Interface Model\AxClass_APFileProcessController.xpp:line 21 at
Dynamics.AX.Application.APFileProcessController.run() at
Dynamics.AX.Application.BatchRun.runJobStaticCodeFromBuffer(Batch buffer)
in xppSource://Source/ApplicationPlatform\AxClass_BatchRun.xpp:line 848 at
Dynamics.AX.Application.BatchRun.runJobStaticFromBuffer(Batch buffer)
in xppSource://Source/ApplicationPlatform\AxClass_BatchRun.xpp:line 770 at
Microsoft.Dynamics.AX.Batch.Batch.ExecuteOneBatchJobTask(BatchTaskInfoWrapper taskInfo
Thanks in Advance,
Gopinath