2009-07-30 43 views
0

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

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 
+0

从.NET Framework代码或您的代码抛出异常吗? – 2009-07-30 16:42:30

+0

需要堆栈跟踪。 – 2009-07-30 16:43:01

回答

0

事实证明,我正在调用一个函数,它调用了我正在尝试访问的函数。

所以,我想解决方案是看看堆栈。应该先做到这一点。

0

推测该文件是存在从以前的成功运行?

0

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

0

也许该文件是由其他客户/用户使用的。