Azure-网站-WebJob-活动FTP下载

Azure-网站-WebJob-活动FTP下载,azure,ftp,Azure,Ftp,我正在使用Windows Azure网站和Web作业 我有一个控制台应用程序,每天晚上用来下载FTP文件。他们最近从被动FTP切换到主动FTP。我无法控制这一切 所附代码在我的计算机上适用于被动和主动。但是,当我将其添加到Azure上的webjob时,它不起作用 在这段代码中,我能够获得内容长度,因此我正确登录,并且有正确的URL Dim request As FtpWebRequest = DirectCast(FtpWebRequest.Create(strTempFTPUrl),

我正在使用Windows Azure网站和Web作业

我有一个控制台应用程序,每天晚上用来下载FTP文件。他们最近从被动FTP切换到主动FTP。我无法控制这一切

所附代码在我的计算机上适用于被动和主动。但是,当我将其添加到Azure上的webjob时,它不起作用

在这段代码中,我能够获得内容长度,因此我正确登录,并且有正确的URL

     Dim request As FtpWebRequest = DirectCast(FtpWebRequest.Create(strTempFTPUrl), FtpWebRequest)

        request.Method = WebRequestMethods.Ftp.GetFileSize
        Dim nc As New NetworkCredential(FTPUserName, FTPPassword)
        request.Credentials = nc
        request.UseBinary = True
        request.UsePassive = False
        request.KeepAlive = True
        request.Proxy = Nothing

        ' Get the result (size)
        Dim resp As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
        Dim contLen As Int64 = resp.ContentLength

        ' and now download the file
        request = DirectCast(FtpWebRequest.Create(strTempFTPUrl), FtpWebRequest)
        request.Method = WebRequestMethods.Ftp.DownloadFile
        request.Credentials = nc
        request.UseBinary = True
        request.UsePassive = False
        request.KeepAlive = True
        request.Proxy = Nothing

        resp = DirectCast(request.GetResponse(), FtpWebResponse)
我收到的错误是:

基础连接已关闭:接收时发生意外错误。这发生在第二个resp=DirectCastrequest.GetResponse、FtpWebResponse上

有人对我能做什么有什么建议吗

编辑:据我所知,这不是虚拟机,我无法控制防火墙。这是一个标准的网站。
多谢各位

我遇到了同样的问题,我可以通过增加每个点的连接限制来解决。默认情况下,它设置为2,I增加为10

req.ServicePoint.ConnectionLimit=10

如果存在超时问题,请同时更改timeout和readwritetimeout属性

下面是一个类似于我们的案例的链接