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

Advertisement

DPR-User
Joined:
Posts:
2
Location:
london

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
    }
}
  • SessionDebug.log (81.81 KB, Private file)
  • SessionLog.log (10.9 KB, Private file)

Reply with quote

Advertisement

DPR-User
Joined:
Posts:
2
Location:
london

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?

Reply with quote

Advertisement

You can post new topics in this forum