Time-Out on session.open

Advertisement

paulo_oli
Joined:
Posts:
3
Location:
São Paulo – Brazil

Time-Out on session.open

Hi Everybody.
I'm using the component for first time.
I copied the c# example in my class and passed the parameters. When pass by session.Open(sessionOptions), after a long time I get "Time out". Do you have any idea about this waiting time on session.open?

Reply with quote

Advertisement

paulo_oli

Re: Time-Out on session.open

Hi prikryl, how is it going?
After I set Session.DegugLogPath I received the error "Object reference not set to an instance of an object" in session.open command.

Reply with quote

paulo_oli
Joined:
Posts:
3
Location:
São Paulo – Brazil

Whole method until this point:
SessionOptions sessionOptions = new SessionOptions {
    Protocol = Protocol.Sftp,
    HostName = ConfigurationSettings.AppSettings["Host"],
    UserName = ConfigurationSettings.AppSettings["UserName"] ,
    Password = ConfigurationSettings.AppSettings["Pass"] ,
    SshHostKey = ConfigurationSettings.AppSettings["HostKey"] 
};
 
using (Session session = new Session())
{
    // Connect
    session.DisableVersionCheck = true;
    session.Timeout = new TimeSpan(0, 2, 0);
    session.SessionLogPath = @"C:\TEMP\logWinSCP";
    session.ExecutablePath = @"C:\Projetos\tools\WinSCP\WinSCP.exe";
    session.IniFilePath = @"C:\Projetos\tools\WinSCP\WinSCP.ini";
 
    session.DebugLogPath = @"C:\TEMP\logWinSCP";
    session.Open(sessionOptions);

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Time-Out on session.open

First, why are you setting DisableVersionCheck? Looks suspicious.

Also, please post a callstack of the exception you are getting. I'm not getting it with your code.

Reply with quote

reachkars
Joined:
Posts:
2
Location:
US - New Jersey

"Timeout waiting for WinSCP to respond" in Session.open

The Session.open(SessionOptions) is throwing a "Timeout waiting for WinSCP to respond." error when executed in our production server.

The same code works perfectly fine in our Development and local servers.

However, we are able to manually execute the WinSCP.exe GUI and connect to the FTP server in our prod server

Kindly advise if there is anypermission related settings we need to consider.

Following is the DebugLog
[2012-08-30 17:32:37Z] [0003] Executing Assembly: WinSCP, Version=1.0.0.528, Culture=neutral, PublicKeyToken=b5f19f5762436b89; Path: E:\inetpub\wwwroot\FinancialReporting.IF.wsTaxIESCrystal\bin\WinSCP.DLL; Location: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\wstaxiescrystal\5c47b0c9\7096f1a3\assembly\dl3\e2b55733\00378d1d_ca48cd01\WinSCP.DLL; Product: 5.0.7.0 
[2012-08-30 17:32:37Z] [0003] Entry Assembly: 
[2012-08-30 17:32:37Z] [0003] Operating system: Microsoft Windows NT 5.2.3790 Service Pack 2 
[2012-08-30 17:32:37Z] [0003] User: TaxiESSVC_QA@AMRS@MPHEW2NCSV011; Interactive: False 
[2012-08-30 17:32:37Z] [0003] Runtime: 2.0.50727.3625 
[2012-08-30 17:32:37Z] [0003] Console encoding: Input: Western European (Windows) (1252); Output: Western European (Windows) (1252) 
[2012-08-30 17:32:37Z] [0003] CallstackAndLock..ctor entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess..ctor entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.GetExecutablePath entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.GetExecutablePath leaving 
[2012-08-30 17:32:37Z] [0003] EXE executable path resolved to E:\inetpub\wwwroot\***\bin\WinSCP.exe 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.CheckVersion entering 
[2012-08-30 17:32:37Z] [0003] Version of E:\inetpub\wwwroot\***\bin\WinSCP.exe is 5.0.7.2268, product WinSCP version is 5.0.7.0 
[2012-08-30 17:32:37Z] [0003] Version check disabled (not recommended) 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.CheckVersion leaving 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess..ctor leaving 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.Start entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.InitializeConsole entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.InitializeConsole leaving 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.InitializeChild entering 
[2012-08-30 17:32:37Z] [0003] Starting "E:\inetpub\wwwroot\***\bin\WinSCP.exe" /xmllog="C:\WINDOWS\TEMP\tmp1453.tmp" /xmlgroups /nointeractiveinput /dotnet=507 /ini=nul /log="E:\Taxies\sFTPSessionLog.txt" /console /consoleinstance=_6296_695 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.InitializeChild leaving 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.Start leaving 
[2012-08-30 17:32:37Z] [0003] Command: [option batch on] 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand leaving 
[2012-08-30 17:32:37Z] [0003] Command: [option confirm off] 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand leaving 
[2012-08-30 17:32:37Z] [0003] Session.SessionOptionsToOpenArguments entering 
[2012-08-30 17:32:37Z] [0003] Session.SessionOptionsToOpenSwitches entering 
[2012-08-30 17:32:37Z] [0003] Session.SessionOptionsToOpenSwitches leaving 
[2012-08-30 17:32:37Z] [0003] Session.SessionOptionsToOpenArguments leaving 
[2012-08-30 17:32:37Z] [0003] Command: [open -hostkey="ssh-rsa 2048 0f:e4:9b:98:e6:af:85:4c:97:c0:fa:c8:4d:14:76:76" -timeout=60 "sftp://***:***@*****.com"] 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand entering 
[2012-08-30 17:32:37Z] [0003] ExeSessionProcess.ExecuteCommand leaving 
[2012-08-30 17:32:37Z] [0009] ExeSessionProcess.ProcessEvents entering 
[2012-08-30 17:33:37Z] [0003] Exception: System.TimeoutException: Timeout waiting for WinSCP to respond. 
at WinSCP.Session.CheckForTimeout() 
at WinSCP.Session.Open(SessionOptions sessionOptions) 
[2012-08-30 17:33:37Z] [0003] Session.Cleanup entering 
[2012-08-30 17:33:37Z] [0003] Command: [exit] 
[2012-08-30 17:33:37Z] [0003] ExeSessionProcess.ExecuteCommand entering 
[2012-08-30 17:33:37Z] [0003] ExeSessionProcess.ExecuteCommand leaving 
[2012-08-30 17:33:37Z] [0003] ExeSessionProcess.Close entering 
[2012-08-30 17:33:39Z] [0003] ExeSessionProcess.Close leaving 
[2012-08-30 17:33:39Z] [0003] ExeSessionProcess.Dispose entering 
[2012-08-30 17:33:39Z] [0009] ExeSessionProcess.ProcessEvents leaving 
[2012-08-30 17:33:39Z] [0003] ExeSessionProcess.Dispose leaving 
[2012-08-30 17:33:39Z] [0003] Session.Cleanup leaving 
[2012-08-30 17:33:39Z] [0003] CallstackAndLock..ctor leaving 
[2012-08-30 17:33:39Z] [0003] CallstackAndLock..ctor entering 
[2012-08-30 17:33:39Z] [0003] Session.DoDispose entering 
[2012-08-30 17:33:39Z] [0003] Session.Cleanup entering 
[2012-08-30 17:33:39Z] [0003] Session.Cleanup leaving
Thanks,
Karthik

Reply with quote

Advertisement

heitorMourao
Guest

same error

I'm getting the same error.
WinSCP.SessionRemoteException: Network Error: connection to "server" timed out.

Reply with quote

Advertisement

jsreepriya@...
Guest

WinSCP.SessionRemoteException: Timeout connecting to SFTP

WinSCP.SessionRemoteException:
Total memory allocated: 7778680
[2021-10-27 22:35:44.139] [0009]   Waiting for request event
[2021-10-27 22:35:44.239] [0009]   2nd generation collection count: 1
[2021-10-27 22:35:44.239] [0009]   Total memory allocated: 7778680
[2021-10-27 22:35:44.239] [0009]   Waiting for request event
[2021-10-27 22:35:44.319] [0009]   Got request event
[2021-10-27 22:35:44.320] [0009]   ExeSessionProcess.ProcessEvent entering
[2021-10-27 22:35:44.320] [0009]     Acquiring communication structure
[2021-10-27 22:35:44.320] [0009]     Acquired communication structure
[2021-10-27 22:35:44.320] [0009]     Print: Network error: Connection to "support.ncodesolutions.com" timed out.

[2021-10-27 22:35:44.320] [0009]     Scheduling output: [Network error: Connection to "support.ncodesolutions.com" timed out.]
[2021-10-27 22:35:44.320] [0009]     Releasing communication structure
[2021-10-27 22:35:44.320] [0006]     Output: [Network error: Connection to "support.ncodesolutions.com" timed out.]
[2021-10-27 22:35:44.320] [0009]     Released communication structure
[2021-10-27 22:35:44.320] [0009]     Response event set
[2021-10-27 22:35:44.320] [0009]   ExeSessionProcess.ProcessEvent leaving
[2021-10-27 22:35:44.320] [0009]   2nd generation collection count: 1
[2021-10-27 22:35:44.320] [0009]   Total memory allocated: 7803220
[2021-10-27 22:35:44.320] [0009]   Waiting for request event
[2021-10-27 22:35:44.322] [0009]   Got request event
[2021-10-27 22:35:44.322] [0009]   ExeSessionProcess.ProcessEvent entering
[2021-10-27 22:35:44.322] [0009]     Acquiring communication structure
[2021-10-27 22:35:44.322] [0009]     Acquired communication structure
[2021-10-27 22:35:44.322] [0009]     ExeSessionProcess.ProcessTitleEvent entering
[2021-10-27 22:35:44.322] [0009]       Not-supported title event [WinSCP]

Reply with quote

sreepriya
Guest

Re: WinSCP.SessionRemoteException: Timeout connecting to SFTP

pls help to resolve this, I'm getting Timeout in session.Open(sessionOptions); with proxy.
My Code session:
string folder_Name = ConfigurationManager.AppSettings["FTP_DirName"].ToString();
string Proxy = ConfigurationManager.AppSettings["Proxy"].ToString();
string Port = ConfigurationManager.AppSettings["Port"].ToString();
string SSHKey = ConfigurationManager.AppSettings["SSHKey"].ToString();
string IsProxy = ConfigurationManager.AppSettings["IsProxy"].ToString();
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.Protocol = Protocol.Sftp;
sessionOptions.HostName = ftpaddess;
sessionOptions.UserName = username;
sessionOptions.Password = password;
sessionOptions.PortNumber = 22;
sessionOptions.Timeout = new TimeSpan(0, 2, 0); //2min
if (IsProxy == "1")
{
    sessionOptions.AddRawSettings("ProxyMethod", "3");
    sessionOptions.AddRawSettings("ProxyHost", Proxy);
    sessionOptions.AddRawSettings("ProxyPort", Port);
}
// SSHKey = "ssh-ed25519 255 gEi/vX6ghBeH//xYd4WjjO+BnEtS3VNXj+YCXz1D3Wk=";
sessionOptions.SshHostKeyFingerprint = SSHKey;
 
try
{
    WinSCP.Session session = new WinSCP.Session();
    //Sftp - support.ncodesolutions.com - 10.94.147.17 - 8080 - ssh - ed25519 255 cwzzhi1C5VrD758U2xyETMzsdYqHg02Ojv6pCenBVy4 =
    session.DisableVersionCheck = true;
    LogWriter.Write("Before Open-:" + Protocol.Sftp + "-" + ftpaddess + "-" + Proxy + "-" + Port+" - "+ SSHKey);
    // session.Timeout = TimeSpan.;
    //session.DebugLogLevel = 2;
    //session.DebugLogPath = @"D:\log\debug.log";
    //session.SessionLogPath = @"D:\log\session.log";
    //Console.WriteLine("Connecting...");
 
    session.Open(sessionOptions);
    LogWriter.Write("Before push-:" + ftpaddess);
    TransferOptions transferOptions = new TransferOptions();
    transferOptions.TransferMode = TransferMode.Binary;
    TransferOperationResult transferResult;
    IEnumerable<FileSystemInfo> fileInfos = new DirectoryInfo(Voice_path).EnumerateFileSystemInfos(filename, SearchOption.AllDirectories);
    string path2 = Path.GetTempFileName();

Reply with quote

wys35
Joined:
Posts:
2
Location:
Suzhou

Same error

Hi,

I am getting the same error.
Log Linked Files Archive - Started - 10/31/2021 2:20:14 AM
Error: System.TimeoutException: Timeout waiting for WinSCP to respond - WinSCP has not responded in time. There was no output. Response log file E:\AbacusAutoCheck2\log\winscp.log was not created. This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
   at WinSCP.Session.CheckForTimeout(String additional)
   at WinSCP.Session.Open(SessionOptions sessionOptions)
   at AbacusLogs2DB.AbacusLogs2DB.LogLinkedFilesArchive()
Log Linked Files Archive - Finished - 10/31/2021 2:21:21 AM
This is the error (call to log linked files procedure) I am getting. According to this article, (https://winscp.net/eng/docs/message_library_timeout_waiting_to_respond), I supplied the user credentials, but now I am getting Win32_exception The stub received bad data error. Googling suggest the process domain is not specified, but I don't see a way to set that.

The task runs under task scheduler using a service account. Manually running the task (VS Studio) under my user account seems fine.

Any clues? I have attached the debug log for reference. For this program, there is no file transfer. It only does a directory listing.
RemoteDirectoryInfo directory = session.ListDirectory("/data");
Regards,
Eddy

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
36,692
Location:
Prague, Czechia

Re: WinSCP.SessionRemoteException: Timeout connecting to SFTP

@sreepriya: How exactly do you run the code? Do you really get the problem only "with proxy"? Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,692
Location:
Prague, Czechia

Re: Same error

wys35 wrote:

I supplied the user credentials, but now I am getting Win32_exception The stub received bad data error. Googling suggest the process domain is not specified, but I don't see a way to set that.
session.ExecutableProcessUserName = "user@domain";

Reply with quote

wys35
Joined:
Posts:
2
Location:
Suzhou

Re: Same error

That worked, however, I am still getting sporadic time out issues. I suspect it's due to the RAM limitations. I increased the timeout to 120 seconds. However, it seems the time out exception occurred after a minute or so. Any thoughts?
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Sftp,
    HostName = "************",
    UserName = "atzzz001",
    Password = "******",
    SshHostKeyFingerprint = "********************",
    Timeout = TimeSpan.FromSeconds(120)
};
10:30:01PM - 10:31:32PM
Updating Clients Linking information from Database LAANDWDB01 - 11/1/2021 10:30:01 PM
Synchronizing Latest Axiom Update Data
Error: System.TimeoutException: Timeout waiting for WinSCP to respond - WinSCP has not responded in time. There was no output. Response log file E:\AxiomAutoCheck2\log\winscp.log was not created. This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
   at WinSCP.Session.CheckForTimeout(String additional)
   at WinSCP.Session.Open(SessionOptions sessionOptions)
   at AxiomLogs2DB.AxiomLogs2DB.downloadNewDataFiles()
Writing Latest Axiom Data Files to Database - 11/1/2021 10:31:32 PM
Update: the timeout is occurring about 1 minute or more after call to session.Open regardless of how I set the timeout value

Reply with quote

Advertisement

You can post new topics in this forum