When there are many files in the remote directory often have session timeout problem, what's the default session time and if increase will be any side effects?
var allFiles = session.EnumerateRemoteFiles(folderIn, null, EnumerationOptions.None);
Part of the error logs:
Timeout waiting for WinSCP to respond
at WinSCP.Session.CheckForTimeout(String additional)
at WinSCP.PatientFileStream.Wait(Int32& interval)
at WinSCP.PatientFileStream.Read(Byte[] array, Int32 offset, Int32 count)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at WinSCP.SessionLogReader.DoRead()
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.Session.ListDirectory(String path)
at WinSCP.Session.<DoEnumerateRemoteFiles>d__86.MoveNext()
WinSCP .NET assembly version 6.1.2
And any difference between the following two:
- setup the timeout in SessionOptions and use it when open the session
var sessionOptions = new SessionOptions
{ Timeout = new TimeSpan(0, 2, 0) };
or 2) open the session then set the timeout value?
session.Timeout = new TimeSpan(0, 2, 0);