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
Joined:
Posts:
3
Location:
São Paulo – Brazil

Re: Time-Out on session.open

Hi @martin, 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

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

Advertisement

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