Re: connect timeout using WinSCPNet in web application
Your duplicate post on Stack Overflow:
https://stackoverflow.com/q/68225741/850848
https://stackoverflow.com/q/68225741/850848
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
Timeout waiting for WinSCP to respond - WinSCP has not responded in time. There was no output. Response log file C:\Windows\TEMP\wscp3BFC.0292A297.tmp was not created.
public SFTP(string sHost, int iPort, string sUserID, string sPassword, string SshHostKeyFingerprint, string ExePath)
{
SFTP_Host = sHost;
SFTP_Port = iPort;
SFTP_UserID = sUserID;
SFTP_Password = sPassword;
SFTP_SshHostKeyFingerprint = SshHostKeyFingerprint;
ExePath = ExePath;
}
public void ConnectSFTP()
{
// Set up session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = SFTP_Host,
PortNumber = SFTP_Port,
UserName = SFTP_UserID,
Password = SFTP_Password,
SshHostKeyFingerprint = SFTP_SshHostKeyFingerprint
};
sessionOptions.AddRawSettings("Cipher", "aes,chacha20,3des,WARN,des,blowfish,arcfour");
SFTP_Session = new Session();
SFTP_Session.ExecutablePath = ExePath;
//SFTP_Session.XmlLogPath = "Z:\\Data\\WinSCP.xml";
//SFTP_Session.SessionLogPath = @"Z:\Data\WinSCP.log";
// Connect
try
{
SFTP_Session.Open(sessionOptions);
TraceLog.appendTransactionLog("Connected to " + SFTP_Host + ":" + SFTP_Port);
}
catch (Exception ex)
{
TraceLog.appendTransactionLog("Failed to connect to " + SFTP_Host + ":" + SFTP_Port + Environment.NewLine + "Error: " + ex.Message);
}
finally
{
if (SFTP_Session != null)
{
SFTP_Session.Dispose();
}
}
}
SFTP client = new SFTP(sftpHost, iSftpPort, sftpUserID, sftpPassword, sshHostKeyFingerprint, ExePath);
client.DownloadFiles();
public string DownloadFiles()
{
ConnectSFTP(); // FAILS HERE ...
try
{
using (SFTP_Session)
{
SFTP_Session.QueryReceived += (sender, e) =>
{
e.Continue();
}
};
....
}
catch (Exception e)
{
...
}
finally
{
if (SFTP_Session != null)
{
SFTP_Session.Dispose();
}
}
}
2021-07-02 08:24:56:169|Failed to connect to 1.2.3.4:22 (ssh-ed25519-hK8U-......)
Error: Timeout waiting for WinSCP to respond - WinSCP has not responded in time. There was no output. Response log file C:\Windows\TEMP\wscp3BFC.0292A297.tmp was not created. This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
WinSCP version is 5.17.10.0.