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: Host does not exist

Are you able to get log if you run WinSCP manually and type the open command in console?
VirtKitty

Host does not exist

Greetings...

I am trying to use SFTP to transfer a file from within VB.NET. I've set up a session and can connect to the server when using the Commander interface. Here's my code in VB.NET
' Run hidden WinSCP process
Dim winscp As Process = New Process()
winscp.StartInfo.FileName = gstrFTPProcessLocation 'Location of WinSCP.com (usually C:\Program Files\WinSCP\winscp.com)
winscp.StartInfo.Arguments = "/log=" + LogName
winscp.StartInfo.UseShellExecute = False
winscp.StartInfo.RedirectStandardInput = True
'winscp.StartInfo.RedirectStandardOutput = True
winscp.StartInfo.CreateNoWindow = True
winscp.Start()

' Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort")
winscp.StandardInput.WriteLine("option confirm off")
winscp.StandardInput.WriteLine("open " & gstrFTPSession) 'This is a session you must setup in WinSCP
winscp.StandardInput.WriteLine("ls")
winscp.StandardInput.WriteLine("put " & strOutFile)
winscp.StandardInput.Close()

' Collect all output (not used in this example)
'Dim output As String = winscp.StandardOutput.ReadToEnd()

' Wait until WinSCP finishes
winscp.WaitForExit()

I get an exit code of 1 and do not get a log file. This code had been working, but I'm connecting to a new FTP site and it's bombing. If I comment out CreateNoWindow, I see the error message is "Host does not exist".

When I use the console (winscp.com) directly from a command line, I get "Host does not exist" as well. I can connect to other stored sessions just fine thru the console. Just this one site it isn't happy with. And when I use commander, it connects to my stored session just fine.

Any help greatly appreciated.