TransferOperationResult.Check Returns without Error while PutFiles still Transferring files.

Advertisement

bcummins
Joined:
Posts:
10

TransferOperationResult.Check Returns without Error while PutFiles still Transferring files.

Hi, First of all, WinSCP has made work life so much easier! So thank you.

These questions apply to VB.NET windows forms application.

Two questions please.

1. transferResult.Check() returns from PutFiles without error but the files are still being copied to the external server. This is causing the job to appear as completed while the files are still being transferred to the external server. What transfer options, if any, can be modified to prevent this behavior? Source code below.
Dim transOptions As New TransferOptions
transOptions.TransferMode = TransferMode.Binary
transOptions.OverwriteMode = OverwriteMode.Overwrite
transOptions.PreserveTimestamp = False
transOptions.ResumeSupport.State = TransferResumeSupportState.Off
 
Dim transferResult As TransferOperationResult = sess.PutFiles(dmzPath, "/" + serverDetails.WebServerFolderPath, False, transOptions)
 
transferResult.Check()
2. We had to change the default value TransferOptions.PreserveTimestamp due to errors we were receiving about timestamp permissions. It stopped the errors but not really clear what this property does? Also, how would TransferOptions PreserveTimestamp affect files being downloaded to an IIS server being displayed on website? I know you are probably not IIS experts. But do you know if PreserveTimestamp = true would make IIS think the file is not a new file and therefore use the cached version?

Appreciate the assistance.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: TransferOperationResult.Check Returns without Error while PutFiles still Transferring files.

bcummins wrote:

1. transferResult.Check() returns from PutFiles without error but the files are still being copied to the external server. This is causing the job to appear as completed while the files are still being transferred to the external server. What transfer options, if any, can be modified to prevent this behavior? Source code below.
The Session.PutFiles is blocking. It does not returns until the transfer is complete. What makes you think otherwise?

2. We had to change the default value TransferOptions.PreserveTimestamp due to errors we were receiving about timestamp permissions. It stopped the errors but not really clear what this property does?
It controls whether WinSCP sets the timestamp of the uploaded file to match the source local file.

Also, how would TransferOptions PreserveTimestamp affect files being downloaded to an IIS server being displayed on website? I know you are probably not IIS experts. But do you know if PreserveTimestamp = true would make IIS think the file is not a new file and therefore use the cached version?
If the WinSCP and the server notion of time and timezones are misaligned somehow, then it might cause that.
See Why are the changes, I upload to webserver, not visible in the web browser?

Reply with quote

bcummins
Joined:
Posts:
10

Thank you for the quick reply! I really do appreciate the help.

The Session.PutFiles is blocking. It does not returns until the transfer is complete. What makes you think otherwise?
I thought this as well and told the users the same thing. The reason I think this is because the status update doesn't get set to 'completed' until after the line transferResult.Check(). The status is showing completed, but if we view the file location where the files are being pushed, the folder list of files keeps growing, meaning the 700 or so files being transferred appear to still being downloaded. We opened Windows 'file explorer' and navigated to the folder where files are being pushed and list of files while monitoring keep growing, indicating the files are still being downloaded?

We will update to the latest WinSCP.dll and .exe and see if this issues still persists.

Thanks again!

Reply with quote

martin
Site Admin
martin avatar

Upgrading WinSCP will unlikely change anything (unless you were using some really ancient version which might have a bug I do not even remember anymore).

Enable logging (Session.SessionLogPath) and check when the transfer ends.

Reply with quote

Advertisement

You can post new topics in this forum