我使用MSDN中列出的代码将文件上传到FTP服务器 。 msdn.microsoft/en-us/library/system.ftpwebrequest .aspx 我提供服务器凭据,设置模式和超时。并且在回调(EndGetStreamCallback)中,它崩溃在 requestStream = state.Request.EndGetRequestStream(ar); 与以下异常 WebException:远程服务器返回错误:( 550)文件不可用(例如,找不到文件,没有访问权限)。 我查看了我的应用程序和站点的FTP流量,并观察到连接成功但是<它有请求:OPT utf8 on响应:550权限被拒绝。和PWD(打印工作目录)是"/ download /"我的路径是"ftp:// ftp.xxx/upload/filename.txt"然后尝试用命令"CWD / download / upload /"更改目录,因为没有这样的目录存在远程服务器重新上传上面提到的错误例外。 请告知。 谢谢你的SM
I am uploading file to FTP server asynchronously using the code listed in MSDN. msdn.microsoft/en-us/library/system.ftpwebrequest.aspx I give the server credentials, set the mode and timeout. And in the callback (EndGetStreamCallback) it crashes at requestStream = state.Request.EndGetRequestStream(ar); with following exception WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access). I looked at the FTP traffic b/w my application and site and observed that the connection was a success but it had Request: OPT utf8 on Response: 550 Permission denied. and the PWD (Print Working Directory) was "/download/" and my since i gave a path "ftp:// ftp.xxx/upload/filename.txt" it then tries to change the directory with the command "CWD /download/upload/", since no such directory exists remote sever reutrned the error mentioned in the above exeption. Please advise. Thanks SM
推荐答案你不能确定在尝试将文件上传到该目录之前,目标目录是否存在? Shouldnt you make sure that the destination directory exists first, before trying to upload a file into that directory?
更多推荐
FtpWebRequest异步上传
发布评论