Session timeout - can't create temporary file

Advertisement

Crash2975
Joined:
Posts:
6

Session timeout - can't create temporary file

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 :(

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.

Reply with quote

Advertisement

Crash2975
Joined:
Posts:
6

Re: Session timeout - can't create temporary file

martin 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.

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

Reply with quote

Crash2975
Joined:
Posts:
6

Re: Session timeout - can't create temporary file

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:

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

Changing the path to local folder didn't change the error (Logging is set off anyway).

Reply with quote

Advertisement

Crash2975
Joined:
Posts:
6

Re: Session timeout - can't create temporary file

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.

Reply with quote

MichaelL
Joined:
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.

Reply with quote

martin
Site Admin
martin avatar

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.

Reply with quote

MichaelL
Joined:
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.

Reply with quote

Advertisement

MichaelL
Joined:
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.

Reply with quote

trevor_hungerford
Joined:
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?

Reply with quote

renuka.mudunuri
Joined:
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:

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

This issue is tracked here:
https://winscp.net/tracker/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.

Reply with quote

a7nkit
Joined:
Posts:
1
Location:
Ahmedabad

can't able to transfer file on server via hosted code.

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: can't able to transfer file on server via hosted code.

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: can't able to transfer file on server via hosted code.

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 :-)
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.

Reply with quote

Endrju
Joined:
Posts:
2

Re: can't able to transfer file on server via hosted code.

martin 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! :)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: can't able to transfer file on server via hosted code.

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! :)
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:
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

Reply with quote

Advertisement

You can post new topics in this forum