This project is read-only.

Data Connection Broken Pipe System.Net.FtpClient

Jan 14, 2014 at 6:22 PM
Hi All,

In my SSIS Script I used the code sample below. I used System.Net.FtpClient and added it in GAC.

The issue is When I'm setting a local ftp address like ,ftp://127.0.0.1/testdirectory (Dummy Ftp Created by FileZilla)

then this code block is working perfectly. But when I'm trying to connect some external ftp addresses (not SFTP!!!)

then this code is throwing exception as : 'data connection : broken pipe'

But those ftp addresses I can browse from my windows> run perfectly.

What I'm I doing wrong? what could be the work around?

Basically I'm trying to handle ftp from script because I need to get filesize in FTP and accordingly need to download them.

...

using System.Net.FtpClient;

....

....

FtpClient conn = new FtpClient();
        conn.Host = ServerName; conn.Credentials = new NetworkCredential(ServerUserName, ServerPassword);
        try
        {
            conn.Connect();
             //Set Working Directory
             if (conn.DirectoryExists(WorkDirectory))
             {   
                conn.SetWorkingDirectory(WorkDirectory);
                if(conn.FileExists(SourceFileName))
                {
                    MessageBox.Show("hello");
                }
             }
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message.ToString());
        }