Error parsing session log file

Advertisement

lakshmi
Joined:
Posts:
3

Error parsing session log file

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,507
Location:
Prague, Czechia

Re: Error parsing session log file

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.

Reply with quote

lakshmi
Joined:
Posts:
3

Re: Error parsing session log file

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]

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,507
Location:
Prague, Czechia

Re: Error parsing session log file

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.

Reply with quote

lakshmi
Joined:
Posts:
3

Re: Error parsing session log file

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,507
Location:
Prague, Czechia

Re: Error parsing session log file

We cannot debug your application.

Why are you unable to store the debug logs?

Reply with quote

sushma
Joined:
Posts:
2
Location:
India

Error parsing session log file

Did you get any solution for this?

must we should give the Session log path and Debug log path?

Reply with quote

Advertisement

You can post new topics in this forum