Hi there,
I delevloped an app using the WinSCP NuGet package. Everything works fine inside my app when running with Visual Studio.
After deploying my package and installing it on the same machine, WinSCP return the error '1004 connection failed' inside the session log. There are actually no differences between running my app inside VS or running it as app installed on the same machine. I am calling the SynchronizeDirectories Method. Log attached.
This is the code inside VB.NET:
If someone could please help me, this would be great.
OS: Win 10
' Setup session options
Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Ftp
.HostName = ftpserver
.UserName = config.ftpuser
.Password = config.ftppassword
End With
Using session As New Session
' Will continuously report progress of synchronization
AddHandler session.FileTransferred, AddressOf FileTransferred
session.SessionLogPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\FestplattenArchiv\WinSCP-Session-Log.log"
session.DebugLogPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\FestplattenArchiv\WinSCP-Debug-Log.log"
session.DebugLogLevel = 2
' Connect
session.Open(sessionOptions)
' Synchronize files
Dim synchronizationResult As SynchronizationResult
synchronizationResult =
session.SynchronizeDirectories(
SynchronizationMode.Local, config.rootpath, "/FestplattenArchiv/Datenbank", True)
If BGW_SyncDir.CancellationPending = True Then
session.Abort()
e.Cancel = True
Exit Sub
End If
' Throw on any error
synchronizationResult.Check()
End Using