Post a reply

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

tgurinder

.Net Assembly - Exception: WinSCP.SessionLocalException: Element "cwd" not found in the log file-

Hi All,

This error was due to mismatch in .EXE installed on my server and .Net wrapper referenced in code. Provided Executable path (as Version can changes on server) and now able to connect.

session.ExecutablePath

Thought of sharing it as I have spent lot of time on it.

Thanks
tgurinder

.Net Assembly - Error: Exception: WinSCP.SessionLocalException: Element "cwd" not found in the log f

This is the code I am using. I am able to connect via WinScp GUI using same credentials. I tried by removing/setting log file paths..same error in both cases. Can anyone help me to resolve it.

With sessionOptions
.Protocol = Protocol.Sftp
.HostName = glo.strBBSFTPServerName
.PortNumber = glo.Port
.UserName = glo.SFTPUsername
.Password = glo.SFTPPassword
.SshHostKeyFingerprint = glo.sshKey
End With
With session
.DisableVersionCheck = True
.DebugLogPath = "C:\Development\WinSCPDebugLog.txt"
.SessionLogPath = "C:\Development\WinSCPSessionLog.xml"
'''.XmlLogPath = "C:\Development\Products\MB\MBLogs\MBDataFeedAgent\WinSCPXMLLog.xml"


End With

session.Open(sessionOptions)

Log file says:
SessionLogReader.Read leaving
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessEvent leaving
[2016-02-10 15:47:23.755Z] [0001] SessionLogReader.Read entering
[2016-02-10 15:47:23.755Z] [0001] Read node 10: Whitespace

[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessEvent entering
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessEvent leaving
[2016-02-10 15:47:23.755Z] [0001] Log contents has not changed
[2016-02-10 15:47:23.755Z] [0001] SessionLogReader.Read leaving
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessEvent entering
[2016-02-10 15:47:23.755Z] [0001] SessionLogReader.Read entering
[2016-02-10 15:47:23.755Z] [0001] Read node 11: EndElement group
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessInputEvent entering
[2016-02-10 15:47:23.755Z] [0001] Log contents has not changed
[2016-02-10 15:47:23.755Z] [0001] SessionLogReader.Read leaving
[2016-02-10 15:47:23.755Z] [0001] Exception: WinSCP.SessionLocalException: Element "cwd" not found in the log file
[2016-02-10 15:47:23.755Z] [0001] ElementLogReader.Dispose entering
[2016-02-10 15:47:23.755Z] [0001] ElementLogReader.ReadToEnd entering
[2016-02-10 15:47:23.755Z] [0001] ElementLogReader.ReadToEnd leaving
[2016-02-10 15:47:23.755Z] [0001] ElementLogReader.Dispose leaving
[2016-02-10 15:47:23.755Z] [0001] Exception: WinSCP.SessionLocalException: Element "cwd" not found in the log file
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.Session.Open(SessionOptions sessionOptions)
[2016-02-10 15:47:23.755Z] [0001] Session.Cleanup entering
[2016-02-10 15:47:23.755Z] [0001] Terminating process
[2016-02-10 15:47:23.755Z] [0001] Command: [exit]
[2016-02-10 15:47:23.755Z] [0001] ExeSessionProcess.ExecuteCommand entering
[2016-02-10 15:47:23.755Z] [0001] ExeSessionProcess.ExecuteCommand leaving
[2016-02-10 15:47:23.755Z] [0003] Scheduling output: [winscp> exit]
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessInputEvent leaving
[2016-02-10 15:47:23.755Z] [0003] ExeSessionProcess.ProcessEvent leaving
[2016-02-10 15:47:23.755Z] [0001] ExeSessionProcess.Close entering
[2016-02-10 15:47:23.755Z] [0001] Waiting for process to exit (2000 ms)
[2016-02-10 15:47:23.864Z] [0003] Process 6388 exited with exit code 0