Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8.7k views
in .NET FTP by (440 points)
I use edtftpnet-2.2.2 to download a file size 2.7G from server (localhost - FileZilla_Server-0_9_41 - download speed 25 KB / s), you encounter an error after:
{Unable to evaluate expression v

14 Answers

0 votes
by (51.1k points)
Can you please post the code that causes this error-message?

- Hans (EnterpriseDT)
0 votes
by (440 points)
code here:


    public class GetFileFromServer
    {
        private  FTPConnection ftpConnection;
        public void connect(string host, string user, string pass)
        {
            ftpConnection = new FTPConnection();
            ftpConnection.ServerAddress = host;
            ftpConnection.UserName = user;
            ftpConnection.Password = pass;
            ftpConnection.Connect();
        }
        public void close()
        {
            ftpConnection.Close();
        }

        public List<string> downloadWebsite(string rootFolder, string pathTarget, List<string> logErr )//string host, string user, string pass,
        {
            //FTPConnection ftpConnection = new FTPConnection();
            //ftpConnection.ServerAddress = host;
            //ftpConnection.UserName = user;
            //ftpConnection.Password = pass;
            //ftpConnection.Connect();

            List<FTPFile> listFilesAndFolder = ftpConnection.GetFileInfos(rootFolder).ToList();
            List<FTPFile> lisFolders = new List<FTPFile>();
            foreach (FTPFile ftpFile in listFilesAndFolder)
            {
                if (ftpFile.Dir)
                {
                    lisFolders.Add(ftpFile);
                }
                else
                {
                    string s = pathTarget + @"\" + ftpFile.Name;
                    string s1 = rootFolder + @"/" + ftpFile.Name;
                    long fileSizeOnDisk = checkExistsFileOnDisk(pathTarget, ftpFile.Name);
                    if (fileSizeOnDisk == -1 || fileSizeOnDisk != ftpFile.Size)
                    {
                        try
                        {
                            if (ftpConnection.Exists(rootFolder + @"/" + ftpFile.Name))
                            {
                                //if (ftpFile.Size > 100000000)
                                //{
                                    //logErr.Add("dung lượng file qu
0 votes
by (51.1k points)
The code looks fine to me. Does this happen when you're debugging or when you run outside the debugger? Is your code built as Debug or release? It might be an idea to enable logging at the debug level and post relevant portions of the log.

- Hans (EnterpriseDT)
0 votes
by (440 points)
when the exception occurs, I can not see where that error (stack trace = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}). I run the debug unit tests. (can you give me your email address, I will send my code to you)
0 votes
by (440 points)
I run debug errors here:(FTPClient.cs)
BytesTransferred(this, new BytesTransferredEventArgs(remoteFile, lastBytesTransferred, resumeMarker));


catch (Exception ex)
log.Error("Caught exception " + ex.Message) = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
0 votes
by (51.1k points)
Have you tried it on other computers? You should also try to change the platform in the project settings.

- Hans (EnterpriseDT)
0 votes
by (440 points)
I think this is a bug of the library, not by the computer, I try using CuteFTP download, completely normal.two errors I often encounter when using the library to download is: {Unable to evaluate expression v
0 votes
by (161k points)
I'm curious about this:

timeout 2147483647 ms


Do you set the timeout yourself?
0 votes
by (440 points)
I try to increase the timeout, see how results.but the error still occurs:

public void connect(string host, string user, string pass)
{
ftpConnection = new FTPConnection();
ftpConnection.ServerAddress = host;
ftpConnection.UserName = user;
ftpConnection.Password = pass;
ftpConnection.Timeout = Int32.MaxValue; // I add this line......
//ftpConnection.ConnectMode = FTPConnectMode.ACTIVE;
ftpConnection.Connect();
FTPConnection.LogLevel = LogLevel.All;
FTPConnection.LogFile = "log.dat";
}
0 votes
by (440 points)
timeout default:

public void connect(string host, string user, string pass)
{
ftpConnection = new FTPConnection();
ftpConnection.ServerAddress = host;
ftpConnection.UserName = user;
ftpConnection.Password = pass;
ftpConnection.Connect();
FTPConnection.LogLevel = LogLevel.All;
FTPConnection.LogFile = "log.dat";
}


DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.886 : ---> SYST
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.888 : 215 UNIX emulated by FileZilla
DEBUG [FTPFileFactory] 29 Jan 2013 13:22:24.888 : Selected UNIX parser
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.890 : ---> PWD
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.890 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.894 : ---> PASV
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.895 : 227 Entering Passive Mode (192,168,1,43,48,92)
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.898 : Server supplied address=192.168.1.43
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.898 : Server supplied port=12380
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.898 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.898 : remoteAddr=192.168.1.43
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.898 : Substituting server supplied IP (192.168.1.43) with remote host IP (192.168.1.43)
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.899 : NewPassiveDataSocket(192.168.1.43,12380)
INFO [BaseSocket] 29 Jan 2013 13:22:24.899 : Connecting to 192.168.1.43:12380 with timeout 120000 ms
DEBUG [BaseSocket] 29 Jan 2013 13:22:24.900 : Successfully connected to 192.168.1.43:12380
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.900 : Connected
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.900 : ---> LIST http
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.901 : 150 Connection accepted
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : Reading ASCII listing data
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 0 Jan 16 09:18 111.txt
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 37080 Oct 08 2012 Barca.html
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->drwxr-xr-x 1 ftp ftp 0 Jan 24 15:51 Barca_files
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 23619 Dec 28 00:18 destop2.gif
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->drwxr-xr-x 1 ftp ftp 0 Dec 28 20:31 hoangclub
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 47616 Oct 07 2012 L11CQCN14-B.xlsL11CQCN14-B.xls
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 634923 Jan 07 14:09 Network Utilities.pdf
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 2751337133 Jan 15 14:35 Pro Evolution So.rar
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 34223 Sep 24 2012 Snapshot_20120925_1.JPG
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->drwxr-xr-x 1 ftp ftp 0 Jan 29 11:25 test.abc
DEBUG [FTPClient] 29 Jan 2013 13:22:24.903 : -->-rw-r--r-- 1 ftp ftp 154517 Oct 08 2012 the-thao.docx
DEBUG [FTPControlSocket] 29 Jan 2013 13:22:24.908 : 226 Transfer OK
DEBUG [FTPClient] 29 Jan 2013 13:22:24.908 : Found 11 listing lines
DEBUG [FTPFileFactory] 29 Jan 2013 13:22:24.909 : Parse() called using culture: Invariant Language (Invariant Country)
DEBUG [FTPFileFactory] 29 Jan 2013 13:22:24.911 : Confirmed format UNIX
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:10.327 : ---> SIZE http/Pro Evolution So.rar
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:10.330 : 213 2751337133
DEBUG [FTPConnection] 29 Jan 2013 13:23:12.558 : DownloadFile(D:\downloadWebsite\Pro Evolution So.rar,http/Pro Evolution So.rar)
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.566 : ---> REST 0
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.567 : 350 Rest supported. Restarting at 0
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.571 : ---> PASV
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : 227 Entering Passive Mode (192,168,1,43,48,101)
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : Server supplied address=192.168.1.43
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : Server supplied port=12389
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : remoteAddr=192.168.1.43
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : Substituting server supplied IP (192.168.1.43) with remote host IP (192.168.1.43)
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.572 : NewPassiveDataSocket(192.168.1.43,12389)
INFO [BaseSocket] 29 Jan 2013 13:23:12.572 : Connecting to 192.168.1.43:12389 with timeout 120000 ms
DEBUG [BaseSocket] 29 Jan 2013 13:23:12.573 : Successfully connected to 192.168.1.43:12389
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.574 : Connected
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.574 : ---> RETR http/Pro Evolution So.rar
DEBUG [FTPControlSocket] 29 Jan 2013 13:23:12.574 : 150 Connection accepted
ERROR [FTPClient] 29 Jan 2013 13:52:06.519 : Caught exception Thread was being aborted.
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : Caught exception
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : System.Threading.ThreadAbortException: Thread was being aborted.
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at EnterpriseDT.Net.Ftp.FTPClient.ReadChunk(Stream input, Byte[] chunk, Int32 chunksize) in D:\CONGTY\ConsoleApplication1\src\net\ftp\FTPClient.cs:line 3718
ERROR [FTPClient] 29 Jan 2013 13:52:06.544 : at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile) in D:\CONGTY\ConsoleApplication1\src\net\ftp\FTPClient.cs:line 3031
DEBUG [FTPControlSocket] 29 Jan 2013 13:52:06.566 : Setting socket timeout=500
DEBUG [FTPControlSocket] 29 Jan 2013 13:52:06.570 : 426 Connection closed; transfer aborted.
INFO [FTPControlSocket] 29 Jan 2013 13:52:06.570 : Expected reply codes = [225,226,250] (strict=False)
ERROR [FTPClient] 29 Jan 2013 13:52:06.582 : Exception in ValidateTransferOnError())
ERROR [FTPClient] 29 Jan 2013 13:52:06.582 : EnterpriseDT.Net.Ftp.FTPException: Connection closed; transfer aborted. (code=426)
ERROR [FTPClient] 29 Jan 2013 13:52:06.582 : at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes) in D:\CONGTY\ConsoleApplication1\src\net\ftp\FTPControlSocket.cs:line 1138
ERROR [FTPClient] 29 Jan 2013 13:52:06.582 : at EnterpriseDT.Net.Ftp.FTPClient.ValidateTransfer() in D:\CONGTY\ConsoleApplication1\src\net\ftp\FTPClient.cs:line 2123
ERROR [FTPClient] 29 Jan 2013 13:52:06.582 : at EnterpriseDT.Net.Ftp.FTPClient.ValidateTransferOnError() in D:\CONGTY\ConsoleApplication1\src\net\ftp\F

Categories

...