FtpWebRequest + Windows Azure = 不工作?

发布于 2024-12-05 06:16:11 字数 166 浏览 4 评论 0原文

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

我目前正在这样做,不确定我的问题是否是 FtpWebRequest 通常未按预期工作,或者是否有其他失败

。以前做过吗?

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

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..

Has sb. did this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

寄居人 2024-12-12 06:16:11

如果您谈论的是 Windows Azure 存储,那么绝对不是。不支持 FTP。

如果您正在使用计算角色,您可以编写一些东西来支持这一点,但它是 DIY,a la:
http:// /blog.maartenballiauw.be/post/2010/03/15/使用-FTP-访问-Windows-Azure-Blob-Storage.aspx

If you're talking about Windows Azure Storage, then definitely not. FTP is not supported.

If you're working with Compute roles, you could write something to support this, but it's DIY, a la:
http://blog.maartenballiauw.be/post/2010/03/15/Using-FTP-to-access-Windows-Azure-Blob-Storage.aspx

北座城市 2024-12-12 06:16:11

我可以使用 FTPLib 解决 ftp 请求的问题。
这意味着:您可以将文件复制/加载到 azure 或外部源!
:-)

I could solve my problem doing the ftp-request with FTPLib.
This means: You can copy/load files to azure or to an external source!
:-)

别再吹冷风 2024-12-12 06:16:11

使其也适用于 AlexFTPS ,您只需添加 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",
                                                 "[email protected]"),
                                                 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);
    }

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",
                                                 "[email protected]"),
                                                 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);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文