这是发生了什么。我正在使用WebClient在FTP上打开一个文件。该文件存在且该函数过去曾起作用,但现在由于某种原因抛出异常。 (System.Net.WebException:远程服务器返回错误:(550)文件不可用(例如,找不到文件,没有访问权限)。)。有趣的是,脚本仍然打开文件并执行它应该做的事情。有没有人听说过这样的事情?

WebClient downloadRequest = new WebClient();
downloadRequest.Credentials = new NetworkCredential(pusername, ppassword);
byte[] downloadBytes = downloadRequest.DownloadData(purl);

这是堆栈跟踪:

[WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).]
System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +287
System.Net.WebClient.DownloadData(Uri address) +106
System.Net.WebClient.DownloadData(String address) +29
ftp_connect.copyFile(String purl, String pusername, String ppassword, String pubordev) in d:\wwwdev\test\ftp\ftpconnect.aspx.cs:112
ftp_connect.copyFolder(String purl, String pusername, String ppassword, String pubordev) in d:\wwwdev\test\ftp\ftpconnect.aspx.cs:160
ftp_connect.Page_Load(Object sender, EventArgs e) in d:\wwwdev\test\ftp\ftpconnect.aspx.cs:93
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
有帮助吗?

解决方案 4

事实证明我正在调用一个调用我试图去的函数的函数。

所以,我想解决的问题是查看堆栈。应该先做。

其他提示

据推测,该文件是从之前的成功运行开始的吗?

脚本可能正在使用Web请求仍在工作时保存的文件版本。

可能该文件由其他客户/用户在用户中。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top