Hi All,
I am getting the same problem as above.
We updated winscp to 5.1.5(The same .Net library too) to fix the bug.. But no use. We changed Xml log folder to application log folder. Still the problem is not resolved.
While runnig manually, the program works fine .. When we schedule the process, we are getting this error:
Timeout waiting for WinSCP to respond - Log file D:\Application\Project\AutoFtpUploaderProcess\Connectlog\XmlLog_040713.log was not created in time, please make sure WinSCP has write permissions to the folder
I researched for a solution but could not find it. I am using the following code:
using (Session session = new Session())
{
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
UserName = FtpConfig.Username,
Password = FtpConfig.Password,
HostName = FtpConfig.Url.ToLower().Replace(@"sftp://", ""),
PortNumber = FtpConfig.PortNumber,
SshHostKeyFingerprint = FtpConfig.HostKeyFingerPrint,
Timeout = TimeSpan.FromSeconds(90)
};
session.DisableVersionCheck = true;
string LogPath = AppDomain.CurrentDomain.BaseDirectory ;
string logDirectory = Path.Combine(LogPath, "Connectlog");
if (!Directory.Exists(logDirectory))
Directory.CreateDirectory(logDirectory);
string xmlLogFilePath = Path.Combine(logDirectory, string.Format("XmlLog_{0:ddMMyyHHMMss}.log", DateTime.Now));
if(File.Exists(xmlLogFilePath)) File.Delete(xmlLogFilePath);
string sessionLogPath = Path.Combine(logDirectory, string.Format("SessionLog_{0:ddMMyy}.log", DateTime.Now));
if (File.Exists(sessionLogPath)) File.Delete(sessionLogPath);
string debugLogPath = Path.Combine(logDirectory, string.Format("DebugLog_{0:ddMMyy}.log", DateTime.Now));
if (File.Exists(debugLogPath)) File.Delete(debugLogPath);
session.XmlLogPath = xmlLogFilePath;
session.SessionLogPath = sessionLogPath;
session.DebugLogPath = debugLogPath;
if (!session.Opened)
session.Open(sessionOptions);//Connection is opened
RemoteDirectoryInfo dInfo = session.ListDirectory(@"/");
RemoteFileInfoCollection fInfo = dInfo.Files;
It is very urgent.. Could any one of you please help me
Thank you,
Regards,
Renuka