Topic "Session timeout - can't create temporary file"

Author Message
Crash2975
[View user's profile]

Joined: 2012-08-10
Posts: 6
I'm running this via a web app on a server over which I have no control, and after a log delay the session open raises an exception:

"Timeout waiting for WinSCP to respond - Log file C:\WINNT\TEMP\tmp1CF4.tmp was not created in time, please make sure WinSCP has write permissions to the folder"

The process almost certainly doesn't have write permissions as the server is locked down. The code functions perfectly on my local machine, of course Sad

I have an .ini file in the same folder as the exe and the assembly and the log/xml options are set off on Session > Logging, and on Storage for it to use .ini and a local Temp folder (and for .rnd) rather than system directory.

Is there any other setting I can change? I'm puzzled by it creating a log file when that option is off. Or do I need to explicitly do this in the session open options? I couldn't see anything.

Many TIA.

Trying to open the .exe on the bin folder through windows explorer causes the window to hang.
Advertisements
Crash2975
[View user's profile]

Joined: 2012-08-10
Posts: 6
Correction, the exe does (eventually) open but after a *very* long time - presumably this is why the session times out in code, which renders it unusable Sad
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Try setting Session.Timeout
https://winscp.net/eng/docs/library_session#properties
_________________
Martin Prikryl
Crash2975
[View user's profile]

Joined: 2012-08-10
Posts: 6
prikryl wrote:


Thanks, Martin

Unfortunately - unless I'm configuring that wrongly, see below - that makes no difference, an exception is still raised after about one minute:

Timeout waiting for WinSCP to respond - Log file C:\WINNT\TEMP\tmp201E.tmp was not created in time, please make sure WinSCP has write permissions to the folder

(This is a different .tmp name from previous so this does seem to be a "genuine" report rather than a catch all)

Why is Winscp trying to use the system TEMP folder when configured not to do so (Preferences > Storage), and why a log file when that is not selected (Session > Logging)? It is reading my .ini file as it's putting the .rnd file into the provided local Temp folder.

Code:
Dim sessionOptions As New SessionOptions()
Dim tim As TimeSpan = TimeSpan.FromMinutes(5)
With sessionOptions
   .Protocol = CType([Enum].Parse(GetType(WinSCP.Protocol), ConfigurationManager.AppSettings.Get("protocol"), True), WinSCP.Protocol)
   .HostName = ConfigurationManager.AppSettings.Get("hostName")
   .UserName = ConfigurationManager.AppSettings.Get("userName")
   .Password = ConfigurationManager.AppSettings.Get("password")
   .SshHostKey = ConfigurationManager.AppSettings.Get("hostkey")
   .Timeout = tim
End With


Thanks
Crash2975
[View user's profile]

Joined: 2012-08-10
Posts: 6
Crash2975 wrote:
Why is Winscp trying to use the system TEMP folder when configured not to do so (Preferences > Storage), and why a log file when that is not selected (Session > Logging)? It is reading my .ini file as it's putting the .rnd file into the provided local Temp folder.


Well, I found this in the .ini file:

Code:
ActionsLogFileName=%25TEMP%25%5C!S.xml


Changing the path to local folder didn't change the error (Logging is set off anyway).
Crash2975
[View user's profile]

Joined: 2012-08-10
Posts: 6
Unfortunately I won't be able to use WinSCP as the server is configured to not permit an .exe to run, so this is probably the reason for the session failing to open.

I'm disappointed I can't use it, because it's a great library/tool and has been easy to use. I hope there will be another opportunity! Good luck and thanks for your hard work on this system.
MichaelL
[View user's profile]

Joined: 2013-01-10
Posts: 3
I'm have the same issue here. I'm able to run the exe interactively and connect through to my host, but running via code I get the message

Timeout waiting for WinSCP to respond - Log file C:\WINDOWS\TEMP\wscp12D8.00323366.tmp was not created in time, please make sure WinSCP has write permissions to the folder at WinSCP.Session.CheckForTimeout(String additional) at WinSCP.Session.Open(SessionOptions sessionOptions)

As with the other poster, I have taken every effort to ensure the log files are not written to the TEMP location, so I'm not sure what to try next.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
MichaelL wrote:
As with the other poster, I have taken every effort to ensure the log files are not written to the TEMP location, so I'm not sure what to try next.

But WinSCP needs to write the logs to that location. You need to allow that.
MichaelL
[View user's profile]

Joined: 2013-01-10
Posts: 3
I've granted full control to the Network Service to C:\Windows\Temp. This should be the correct account as that is the identity of my IIS application pool, and also I can see the WinSCP process running as Network Service if I watch the processes in the Task Manager. I'm still receiving the message:

Timeout waiting for WinSCP to respond - Log file C:\WINDOWS\TEMP\wscp1DA8.01A0008D.tmp was not created in time, please make sure WinSCP has write permissions to the folder

I'm running Windows Server 2003 SP2 and WinSCP 5.1.3. Are there any known issues or resolutions? Thanks.
trevor_hungerford
[View user's profile]

Joined: 2013-06-20
Posts: 2
Location: Sydney, Australia
I am having exactly the same problem. Is there any resolution to this issue?
MichaelL
[View user's profile]

Joined: 2013-01-10
Posts: 3
From my expirimentation, WinSCP stopped writing to WINDOWS\TEMP when I set the XML logging to a path relative to my IIS application. eg Application\logs.

From here in addition to the app pool identity having persmissions to this folder, I needed to grant AD users read/write access since my application is using AD impersonation. (identity impersonate="true")

Hope this helps.
trevor_hungerford
[View user's profile]

Joined: 2013-06-20
Posts: 2
Location: Sydney, Australia
MichaelL wrote:
From my expirimentation, WinSCP stopped writing to WINDOWS\TEMP when I set the XML logging to a path relative to my IIS application. eg Application\logs.

From here in addition to the app pool identity having persmissions to this folder, I needed to grant AD users read/write access since my application is using AD impersonation. (identity impersonate="true")

Hope this helps.


Thanks for the reply, how did you set the XML logging path?
renuka.mudunuri
[View user's profile]

Joined: 2013-07-04
Posts: 1
Location: London
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:

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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
This issue is tracked here:
https://winscp.net/tracker/show_bug.cgi?id=996

Currently the only known resolution is to restart the affected machine.

To prevent the problem from reoccurring, please try suggestion by another user to set both your and WinSCP executables to 2003 compatibility mode.

Please let us know if this helped or not.

Thanks.
_________________
Martin Prikryl
a7nkit
[View user's profile]

Joined: 2014-06-17
Posts: 1
Location: Ahmedabad
hey ,

i am using winscp 5.5.3.
the file transfer code is working properly on my local machine but when i am trying to transfer via hosted site so it gives me an error like "File Can not trasfer to FTPserver.Timeout waiting for WinSCP to respond - WinSCP has not responded in time (response log file [Path]\WinSCP\winLog.xml was not created). This could indicate lack of write permissions to the log folder or problems starting WinSCP itself."

but the same code is working in local machine so can you please help.
and yeah the error take 2 minutes for fire . i didn't gives any timeout code.

and make sure i did upgrade and restart server , even though i get this issue.

so please give me proper solution as soon as possible.

Thank you,
Ankit Patel.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
a7nkit wrote:
the file transfer code is working properly on my local machine but when i am trying to transfer via hosted site so it gives me an error like "File Can not trasfer to FTPserver.Timeout waiting for WinSCP to respond - WinSCP has not responded in time (response log file [Path]\WinSCP\winLog.xml was not created). This could indicate lack of write permissions to the log folder or problems starting WinSCP itself."

Did you read this?
https://winscp.net/eng/docs/message_library_timeout_waiting_to_respond
_________________
Martin Prikryl
Endrju
[View user's profile]

Joined: 2014-08-25
Posts: 2


Martin please tell what is the minimum version number of WinSCP that is required to work with the .NET connector? In one project they told me that I only can use WinSCP 4.2.9, and it seems that this version won't cooperate Smile

Thanks!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Endrju wrote:
Martin please tell what is the minimum version number of WinSCP that is required to work with the .NET connector? In one project they told me that I only can use WinSCP 4.2.9, and it seems that this version won't cooperate Smile

By ".NET connector", do you mean the ".NET assembly"? The assembly has been implemented in 5.0.6 beta. But you should always use the latest stable release.
_________________
Martin Prikryl
Endrju
[View user's profile]

Joined: 2014-08-25
Posts: 2
prikryl wrote:
By ".NET connector", do you mean the ".NET assembly"? The assembly has been implemented in 5.0.6 beta. But you should always use the latest stable release.

Yes, I mean .NET assembly. Kindly please add info about minimum required WinSCP version which work with .NET to the download page, to any place in which the info will be obvious, and also to https://winscp.net/eng/docs/message_library_timeout_waiting_to_respond as it is possibly a cause of problem for some users (as it was in our case -- it took me an hour to dig through sources of WinSCP 4.2.9, then 5.5.5, then .NET connector to see why it doesn't work). It also causes false reports, and you need to waste your time responding to them etc. etc. Thanks in advance! Smile
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Endrju wrote:
Yes, I mean .NET assembly. Kindly please add info about minimum required WinSCP version which work with .NET to the download page, to any place in which the info will be obvious, and also to https://winscp.net/eng/docs/message_library_timeout_waiting_to_respond as it is possibly a cause of problem for some users (as it was in our case -- it took me an hour to dig through sources of WinSCP 4.2.9, then 5.5.5, then .NET connector to see why it doesn't work). It also causes false reports, and you need to waste your time responding to them etc. etc. Thanks in advance! Smile

The only reason you might get the "Timeout waiting for WinSCP to respond" error due to a version is that you are using a different version of the assembly and WinSCP (what is never recommended) and you explicitly disabled the version check using Session.DisableVersionCheck. Quoting note at this property:
Quote:
Note, even if you set this property, you need to use the assembly with compatible WinSCP executable only. Otherwise the behavior is unpredictable. In general, it is not recommended to use this. In neither case you will be able to use the assembly with WinSCP 5.0.4 or older.

See https://winscp.net/eng/docs/library_session#fn1
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License