Re: If I run it from a Windows service, Connection fails
Thanks for your feedback.
TcpClient in the service.
TcpClient from the service? And if you right after that try to connect with WinSCP .NET assembly from the same code, does it fail?
Open method and then open the log file again, everything works fine.
C:\Windows\System32>nslookup sftp.commerce-connector.com
Servidor: 250.red-80-58-61.staticip.rima-tde.net
Address: 80.58.61.250
Respuesta no autoritativa:
Nombre: sftp.commerce-connector.com
Addresses: 3.127.84.184
3.126.178.237
52.29.213.126
. 2022-03-07 10:22:57.234 Looking up host "sftp.commerce-connector.com" for SSH connection
. 2022-03-07 10:22:57.265 Connecting to 52.29.213.126 port 22
. 2022-03-07 12:20:22.640 Looking up host "sftp.commerce-connector.com" for SSH connection
. 2022-03-07 12:20:22.671 Connecting to 3.127.84.184 port 22
Session.ListDirectory, but that's another topic)
SshHostKeyFingerprint with the rest of credentials (without scan it).
SshHostKeyFingerprint with the rest of credentials (without scan it).
Session.ScanFingerprint for each and every connection, you are only ineffectively doing the same what you can achieve by setting SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey
SshHostKeyPolicy.AcceptNew.
mySessionOptions.SshHostKeyFingerprint because if I don't, we get error:
SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set.
mySession.ScanFingerprint(mySessionOptions, "SHA-256") and assign mySessionOptions.SshHostKeyFingerprint before executing mySession.Open mySessionOptions.
SshHostKeyFingerprint, but then how?
C:\windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe "C:\NTV\DLL\WinSCPnet.dll" /codebase /tlb
winscp.exe is in C:\NTV\DLL, too.
Session.SessionLogPath and Session.DebugLogPath and post the logs.
WinSCPnet.dll for connect to SFTP.