Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WinSCP.SessionRemoteException: Error transferring file

It does not look like, you have attached the log, for the session, that have the "Connection has been unexpectedly closed. Server sent command exit status 0." error.

In the log, I can only see "Access denied" .. "Disconnected: Unable to authenticate", because you are probably using wrong credentials.
Amit

Re: WinSCP.SessionRemoteException: Error transferring file

Hi,

We were able to do a successful test on local machine using FTP.
However, we are facing issues using SFTP on production. Please see details below. Please note that we have already supplied Ssh Host Key Fingerprint which is required for SFTP.

Application error details==============================
Process : ConnectToServerAndUploadFile : Message - Connection has been unexpectedly closed. Server sent command exit status 0. [StackTrace - at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForGroupAndCreateLogReader()
at WinSCP.Session.Open(SessionOptions sessionOptions)
at EBTAAmexUpload.Process.ConnectToServerAndUploadFile(String localPath, String winScpExeWithPath, String sessionLogPath)]
=======================================================

Please see attached SessionLog20170314.txt - WinSCP session log file of relevant test - for your reference.


Thanks & Regards.

Amit wrote:

martin wrote:

OK, so your server runs on Windows. That's why the error message looked like local, while it was actually remote. So my advice above were indeed wrong.

The actual problem is that you probably miss a slash at the end of the target path.
The FTPFolder should be /inbox/.


Thanks a lot.
Amit

Re: WinSCP.SessionRemoteException: Error transferring file

martin wrote:

OK, so your server runs on Windows. That's why the error message looked like local, while it was actually remote. So my advice above were indeed wrong.

The actual problem is that you probably miss a slash at the end of the target path.
The FTPFolder should be /inbox/.


Thanks a lot.
martin

Re: WinSCP.SessionRemoteException: Error transferring file

OK, so your server runs on Windows. That's why the error message looked like local, while it was actually remote. So my advice above were indeed wrong.

The actual problem is that you probably miss a slash at the end of the target path.
The FTPFolder should be /inbox/.
Amit

Re: WinSCP.SessionRemoteException: Error transferring file

martin wrote:

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.


Please review attached log file as you requested, and let us know your observations and resolution based on that.
Please let us know if any more information is required from our end.


Thanks.
martin

Re: WinSCP.SessionRemoteException: Error transferring file

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

Re: WinSCP.SessionRemoteException: Error transferring file

martin wrote:

If you need more help, you need to tell us something about your environment. How do you run the code?


As of now, I run the code locally on my local machine for testing, using Visual Studio IDE and I have checked in code that it runs on the windows identity/account to which I have already given permissions on the required folders/files for FTP transfer.

Please let me know if you need more information.
martin

Re: WinSCP.SessionRemoteException: Error transferring file

If you need more help, you need to tell us something about your environment. How do you run the code?
Amit

Re: WinSCP.SessionRemoteException: Error transferring file

Hi,

Your quick response is appreciated. I have tried what you suggested, but still the issue is there.

martin wrote:

Error transferring file 'C:\India-Dev\EMEA\NetSearch\EBTA Service\trunk\EBTAAmexUpload\TEST\AmexUpload\FileUpload\IM1I50EBA'. ---> WinSCP.SessionRemoteException: Copying files to remote side failed.
Access is denied.
Win32 error: Access is denied.
Error details: File system denied the access.


The local account that runs your code does not have an access to the file you want to upload.
Amit

Re: WinSCP.SessionRemoteException: Error transferring file

I have verified that all permissions are okay. Am I missing anything?
Could you please assist in what else I can check?

Thanks.

martin wrote:

Error transferring file 'C:\India-Dev\EMEA\NetSearch\EBTA Service\trunk\EBTAAmexUpload\TEST\AmexUpload\FileUpload\IM1I50EBA'. ---> WinSCP.SessionRemoteException: Copying files to remote side failed.
Access is denied.
Win32 error: Access is denied.
Error details: File system denied the access.


The local account that runs your code does not have an access to the file you want to upload.
martin

Re: WinSCP.SessionRemoteException: Error transferring file

Error transferring file 'C:\India-Dev\EMEA\NetSearch\EBTA Service\trunk\EBTAAmexUpload\TEST\AmexUpload\FileUpload\IM1I50EBA'. ---> WinSCP.SessionRemoteException: Copying files to remote side failed.
Access is denied.
Win32 error: Access is denied.
Error details: File system denied the access.


The local account that runs your code does not have an access to the file you want to upload.
Amit

WinSCP.SessionRemoteException: Error transferring file

Hi,

In the .net application that we are using, we are getting the error as shown below.
Please help us resolve it asap.

CODE:=======================================================================
using (Session objSession = new Session())
{
objSession.ExecutablePath = winScpExeWithPath;

// Connect
objSession.Open(objSessionOptions);

// Upload files
TransferOptions objTransferOptions = new TransferOptions();
objTransferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult = objSession.PutFiles(localPath, FTPFolder, false, objTransferOptions);
// Transfer result
if (!transferResult.IsSuccess)
{
WriteLog("File transfer error: " + transferResult.Transfers[0].Error + Environment.NewLine + "Details:" + Environment.NewLine + (((System.Exception)(transferResult.Transfers[0].Error)).InnerException).Message);
return false;
}
else
{
return true;
}
}
ERROR LOG:=======================================================================
File transfer error: WinSCP.SessionRemoteException: Error transferring file 'C:\India-Dev\EMEA\NetSearch\EBTA Service\trunk\EBTAAmexUpload\TEST\AmexUpload\FileUpload\IM1I50EBA'. ---> WinSCP.SessionRemoteException: Copying files to remote side failed.
Access is denied.
Win32 error: Access is denied.
Error details: File system denied the access.
End
--- End of inner exception stack trace ---
Details:
Copying files to remote side failed.
Access is denied.
Win32 error: Access is denied.
Error details: File system denied the access.
End