Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Guest

Here, I have attached screenshot for session log settings in UI.
Guest

Hi Martin,

Sorry for delay, actually I am not getting notification when you are posting comment so.
Anyways, I have attached session log from GUI with normal level.

And attached debug and session log, after removing session.DebugLogLevel = 1;

Please check 3 files I have attached.
Thanks,
martin

For the complete log, simply do not edit it before posting.
For the Normal logging level, remove the session.DebugLogLevel = 1;.
Guest

Hi Martin,

Can you please let me know from where I can get normal complete log file from .NET code?

Guide me here please.
Thanks,
martin

Complete log files, both on the Normal logging level please.
Guest

Hi Martin,

I have attached session log from GUI also, please check that also.
Thanks,
Guest

Hi Martin,

Thanks for reply,
Here I have attached session log, I keep active process for more than 10 minutes. then I stopped session and then session log generated.

Please have a look in session log file.
martin

Re: Network error: Software caused connection abort

Please attach session log files both from the .NET assembly and the GUI.
Aslam

Network error: Software caused connection abort

Hi,
I am trying send files from one machine to other through SFTP, but always getting error through the code, while I am sending the file from WinSCP GUI then it always successfully sent. Only issue through the .NET code. Below is the code I have done.
var sessionOptions = new SessionOptions();
sessionOptions.Protocol = Protocol.Sftp;
sessionOptions.HostName = pHostName; 
sessionOptions.UserName = pUserName;
sessionOptions.Password = pPassword;
sessionOptions.PortNumber = pPortNumber;
sessionOptions.Timeout = TimeSpan.FromSeconds(600);
sessionOptions.SshHostKeyFingerprint = pHostKey;   
using (var session = new Session())
{
    // Connect
    try
    {
        session.DisableVersionCheck = true;
    }
    catch (Exception ex)
    {
    }
    finally
    {
        GC.Collect();
    }
 
    session.DebugLogLevel = 1;
    session.DebugLogPath = @"D:\winscp_log\debug\debug.log";
 
    session.Open(sessionOptions);
    logwriter.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "****************WinSCP Session established");
 
    var transferOptions = new TransferOptions();
    transferOptions.TransferMode = TransferMode.Binary;
    transferOptions.OverwriteMode = OverwriteMode.Overwrite;
 
    TransferOperationResult transferResult;
    if (pCloudTransfer == true)
    {
        logwriter.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "****************Inside cloud transfer flag.");
 
        transferResult = session.PutFiles(pInputFolderName + @"\*.csv", "/" + pCUploadFolder + "/", true, transferOptions);
    }
    else
    {
        logwriter.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "****************Inside dubai server flag.");
 
        transferResult = session.PutFiles(pInputFolderName + @"\*.csv", "/" + pDUploadFolder + "/", true, transferOptions);
    }
 
    // Throw on any error
    transferResult.Check();
 
    // Print results
    foreach (TransferEventArgs transfer in transferResult.Transfers)
    {
        Console.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "****************Upload of " + transfer.FileName + " succeeded");
        logwriter.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "****************Upload of " + transfer.FileName + " succeeded");
    }
}