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: Unable to transfer large files - Network error: Software caused connection abort

Sorry, I didn't notice. Though it should be SshSimple=0.
See SendBuf=0 Not Doing Its Job?
DPR-User

Re: Unable to transfer large files - Network error: Software caused connection abort

Here is what I set in my sessions options:
$sessionOptions.AddRawSettings("SendBuf", "0") 
$sessionOptions.AddRawSettings("SshSimple", "1")

I thought this is the correct settings to disable the Optimize connection buffer size?
martin

Re: Unable to transfer large files - Network error: Software caused connection abort

Did you try disabling "Optimize connection buffer size" option, as the log suggests?
https://winscp.net/eng/docs/rawsettings#sendbuf
DPR-User

Unable to transfer large files - Network error: Software caused connection abort

Hi,
I am trying to automate the upload of few files nightly using the .NET Assembly and it's working for most of my files except 1 file, the file is ~5GB in size.
When I run the PS script interactively from PS ISE it work 100% all the time, but when the task run from Task Scheduler (under my user account) it fails for that specific file.
I am sure this is environmental issue and it's related to some settings but I am unable to figure out which setting I am missing.

I am attaching the debug log and the regular log for two different sessions.

here is my session setting in PS:
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
      Protocol = [WinSCP.Protocol]::Sftp
      HostName = "10.XXX.XXX.XXX"
      UserName = "XXX"
      PrivateKeyPassphrase = 'xxx'
      SshPrivateKeyPath = "C:\Program Files\WinSCP-Portable\WinSCP_Auth\XYZ.ppk"
      SshHostKeyFingerprint = "ssh-rsa 2048 XXXXXXXXXXXXXX="
     }
 
$sessionOptions.AddRawSettings("SendBuf", "0")
$sessionOptions.AddRawSettings("SshSimple", "1")
 
$session = New-Object WinSCP.Session
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.PreserveTimestamp = $false
 
Function Connect-To-SFTP {
 
    # Check if session is already in progress
    If ($session.Opened) {
     
        Write-Host "SFTP session is already open.. proceed"
        return $true
    }
 
    # Setup session options
    $session.SessionLogPath = $LogFile
    $session.DebugLogPath = $DebugFile
 
    try {
       
        # Try Connecting to the SFTP
        Write-host "Connecting to the SFTP server"
        $session.Open($sessionOptions)
       
        write-host "Connected, Switching to binary transfer"
        $transferOptions = New-Object WinSCP.TransferOptions
        $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
       
        return $true
    }
    catch {
        Write-Host "Error: $($_.Exception.Message)"
        return $false
    }
}