以下是发生了什么事情。我正在使用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
从.NET Framework代码或您的代码抛出异常吗? – 2009-07-30 16:42:30
需要堆栈跟踪。 – 2009-07-30 16:43:01