FtpWebRequest + Windows Azure = not working?

2019-08-30 04:57发布

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?

3条回答
相关推荐>>
2楼-- · 2019-08-30 05:25

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

查看更多
Deceive 欺骗
3楼-- · 2019-08-30 05:29

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! :-)

查看更多
Ridiculous、
4楼-- · 2019-08-30 05:30

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);
    }
查看更多
登录 后发表回答