Topic "Error parsing session log file"

Author Message
lakshmi
[View user's profile]

Joined: 2015-11-18
Posts: 3
We followed the below link while winscp.net implementation by using version 5.7.6(Build 5874).

https://winscp.net/eng/docs/library#csharp

As part of file upload, SessionLogPath is mandatory before open session.

So we start with the following code after Setuping the session options


session.SessionLogPath = @"D:\winScpLog\";
session.Open(sessionOptions);

While executing we got the following error.

Error parsing session log file:

{WinSCP.SessionLocalException: Error parsing session log file ---> System.Xml.XmlException: '', hexadecimal value 0x07, is an invalid character. Line 2, position 62.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at WinSCP.SessionLogReader.DoRead()
--- End of inner exception stack trace ---
at WinSCP.SessionLogReader.DoRead()
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.Session.Open(SessionOptions sessionOptions)
at WinSCPFileUpload.Form1.BtnUpload_Click(Object sender, EventArgs e)

Please guide us to solve the issue related to file upload task.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please attach a full debug log file (Session.DebugLogPath) showing the problem.

You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names. If you do not want to post the log publicly, you can mark the attachment as private or email it to me.
lakshmi
[View user's profile]

Joined: 2015-11-18
Posts: 3
Thanks for your support.

As par your suggestion,I set the Session.DebugLogPath and checked the application with fallowing code lines.

WinSCP.SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "xxx.xxx.xx.xxx",
UserName = "xxxxxx",
Password = "xxxxxx",
SshHostKeyFingerprint = "ssh-rsa 1536 xx:xx:xx:xxx"
};
using (Session session = new Session())
{
session.SessionLogPath = Server.MapPath("~/Log/logSftp.log");////"your log path";
session.DebugLogPath = Server.MapPath("~/Log/logSftp.log");

session.ExecutablePath = Server.MapPath("~/bin/winscp.exe");
session.DisableVersionCheck = true;
// Connect
session.Open(sessionOptions);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(@"d:\toupload\*", "/home/user/", false, transferOptions);

// Throw on any error
transferResult.Check();
}


Even-though I got the same error while calling the statement session.Open(sessionOptions).Kindly provide guide lines how to configure the session related logging information.



[quote="prikryl"]Please attach a full debug log file ([m]Session.DebugLogPath[/m]) showing the problem.

[size=12]You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names. If you do not want to post the log publicly, you can mark the attachment as private or email it to me.[/size][/quote]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
The SessionLogPath and the DebugLogPath must be different.

And mainly, this was not supposed to fix the problem. This was to generate the debug log file, so that you can attach it here for us to investigate.
lakshmi
[View user's profile]

Joined: 2015-11-18
Posts: 3
I am sending the sample application for your reference.I am unable to store the debug logs.Please provide further steps to upload files.
WinSCPExample.zip (4.56 MB) Private file

Description: Sample application

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
We cannot debug your application.

Why are you unable to store the debug logs?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License