Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Connection failed after .net deployment, working fine in Visual Studio

Your hostname starts with UTF-8 BOM. I guess that you read the hostname from a first line of some configuration file. The configuration file has UTF-8 BOM, but you read the file as if it is a plain ascii file, not UTF-8. So I do not think that your problem has anything to do with WinSCP.
maxi07

Connection failed after .net deployment, working fine in Visual Studio

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