简体   繁体   中英

Problems Downloading from FTP

I'm trying to download a FTP file from one of our clients, but in production it fails with this message: "Operation timeout exceeded", but if you try to open the FTP location from browser, it opens without problem. During develop this happened because of the proxy, but also blocked the browser. In production, the proxy was shutdown but still fails. I need help with this.

This is the code for the download

    using (WebClient vloftpClient = new WebClient())
    {
         vloftpClient.Credentials = new System.Net.NetworkCredential(vlcUsuario, vlcClave);
         vloftpClient.DownloadFile(@vlcUbicacionOrigen + @"/" + vlcNombreArchivoOrigen, pvcUbicacionDestino + @"/" + pvcProveedor + "_" + vlcNombreArchivoDestino);        
    }

WebRequestClient offers a better solution for working such as mode of transfer. so use as below

FtpWebRequest objFtp;
objFtp.Method = ...DownloadFile
objFtp.ReadWriteTimeout = objFtp.Timeout = 'a value in terms of millisecond'

at last , try to download the files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM