1

I have built an Console Application that reads and move files from a remote FTP. Everything has gone smoothly until I deployed the code to the production environment.

The first thing I ask for when I connect to the FTP is the listDirectory which works in both environments. After that I try to move files from the root but that only works in the dev environment!? In production I get following error code: "The remote server returned an error (451) local error in processing"

Here is the code for moving one file:

var uri = new Uri("ftp://ftp.example.com/test.xml");
var request = (FtpWebRequest)WebRequest.Create(uri);

request.Credentials = new NetworkCredential(_username, _password);
request.UsePassive = true;
request.Method = WebRequestMethods.Ftp.Rename;
request.RenameTo = "/folder/test.xml";

(FtpWebResponse)request.GetResponse();

Should also mention that I'am able to move files in production by using the command line:

ftp ftp.example.com

Username: .....

Password: .....

rename test.xml /folder/test.xml

250 File successfully renamed or moved

I have ran out of ideas, so all help is appreciated!

PS. I connect to the same FTP host with the same credentials in both enviroments and I can also read files in both environments.

Community
  • 1
  • 1
  • Check this: http://stackoverflow.com/questions/3035610/unable-to-rename-file-with-ftp-methods-when-current-user-directory-is-different – Adriano Repetti Mar 06 '13 at 10:11

1 Answers1

0

I had the same issue. In our case it was the version of .Net Framework. The server that had 4.0 installed got the "(451) local error in processing" error. Those that had 4.5. installed ran without a problem. So we installed .Net Framework 4.5 on our app server and that solved the issue.