收到ftp 505错误 [英] getting ftp 505 error

查看:295
本文介绍了收到ftp 505错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行以下代码时出现错误.仅当我在Win XP计算机上运行exe时,会发生这种情况.对于WIN-7,它工作正常.

I am getting an error while i run the code below. This happens when only i run the exe on a Win XP machine. For WIN-7, it is working fine.

private bool GetFileSize(FileInfo targetFI, long FileUploadedSize, string g_Subdivision,TMWaitDialog tmwaitdialog)
          {
              FtpWebRequest reqFTP;
              long fileSize = 0;
              try
              {
                  string Uri = string.Empty;
                  Uri = @"ftp://" + ftpServerIP + "/" + g_Subdivision + "/" + targetFI.Name.ToUpper().Trim();
                  reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(Uri.Trim()));
                  reqFTP.Method = WebRequestMethods.Ftp.GetFileSize;
                  reqFTP.UseBinary = true;
                  reqFTP.KeepAlive = false;
                  reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
                  FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                  Stream ftpStream = response.GetResponseStream();
                  fileSize = response.ContentLength;
                  
                  ftpStream.Close();
                  response.Close();
                return (fileSize == FileUploadedSize);
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
                  return false;
              }
             
          }



下面提到我在运行exe时遇到的错误.
远程服务器返回错误:(550)文件不可用(例如,找不到文件,无法访问).
注意:g_Subdivision表示ftp文件夹名称
文件路径正确,并且该文件存在于ftp中.
有人可以帮我解决问题.



The error i am getting when i run the exe is mentioned below.
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Note: g_Subdivision denotes ftp folder name
The filepath was correct and the file is existing in the ftp.
Can somebody help me to sort the issue.

推荐答案



很少查询:

1.两个系统不同吗?
2.您是否检查系统是否对该FTP站点具有访问权限?
Hi,

Few queries:

1.Are the 2 systems different?
2.Did you check whether the system has access permission for that FTP site?


大家好,

问题不在于权限. ftp站点具有读/写等权限.
我用病毒扫描程序扫描了ftp站点,并且该代码在Win 7和Win XP上均可使用.因此,我搜索了问题的根本原因,发现错误是由于FTP响应超时所致.由于ftp中有病毒影响,因此FTP响应正试图从FTP中获取它.听了几分钟后,它就超时了.现在,带有列出代码的exe可以在两个OS上正常使用.

谢谢您的帮助...
Hi All,

The problem was not because of the permissions. The ftp site is having permissions for read/write etc.
I scanned the ftp site with a virus scanner and, the code is working with both Win 7 and Win XP. So I searched for the root cause of the problem and I found that the, error is because of the FTP response timeout. Due to virus affection in the ftp, the FTP response is trying to get it from the FTP. After listening several minutes, it goes to timeout. Now the exe with the listed code is working for both OS.

Thanks you for helping...


这篇关于收到ftp 505错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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