FtpWebRequest + Windows Azure =不起作用? [英] FtpWebRequest + Windows Azure = not working?

查看:53
本文介绍了FtpWebRequest + Windows Azure =不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 FtpWebRequest (ASP.NET/C#)在Windows Azure上下载数据?

Is it possible download data on Windows Azure via FtpWebRequest (ASP.NET/C#)?

我目前正在执行此操作,不确定我的问题是否是 FtpWebRequest 通常无法正常工作,或者我是否有其他故障..

I am doing this currently and not sure if my problem is that FtpWebRequest is in general not working as expected, or if I have a different failure..

有.以前做过吗?

推荐答案

还可以通过 AlexFTPS进行此工作,您只需要添加 StartKeepAlive .

Make this working also with AlexFTPS , you just need to add StartKeepAlive.

  try
    {
        string fileName = Path.GetFileName(this.UrlString);
        Uri uri = new Uri(this.UrlString);

        string descFilePath = Path.Combine(this.DestDir, fileName);

        using (FTPSClient client = new FTPSClient())
        {
            // Connect to the server, with mandatory SSL/TLS 
            // encryption during authentication and 
            // optional encryption on the data channel 
            // (directory lists, file transfers)
            client.Connect(uri.Host,
                           new NetworkCredential("anonymous",
                                                 "name@email.com"),
                                                 ESSLSupportMode.ClearText
            );
            client.StartKeepAlive();
            // Download a file
            client.GetFile(uri.PathAndQuery, descFilePath);
            client.StopKeepAlive();
            client.Close();
        }

    }
    catch (Exception ex)
    {
        throw new Exception("Failed to download", ex);
    }

这篇关于FtpWebRequest + Windows Azure =不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆