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

Advertisement

maxi07
Joined:
Posts:
1
Location:
Munich

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
Description: I crossed out the server and user info, these are correct.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

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.

Reply with quote

Advertisement

You can post new topics in this forum