远程服务器返回错误:(550)文件不可用(错误发生于使ftp目录) [英] The remote server returned an error: (550) File unavailable(Error occured on making ftp directory)
问题描述
我开发一个WPF应用程序,我想做出使用C#有不同的用户名FTP目录,如果它已经存在,然后将其保存在现有目录中的文件。
I am developing a wpf application and I want to make a directory on ftp using C# with different usernames and if it already exists then save files on existing directory.
我已经成功地创建检查现有目录的逻辑,但在创建新的目录,我得到了在运行时异常:
I've successfully created the logic of checking the existing directory but while creating a new directory I've got an exception on runtime:
远程服务器返回错误:(550)文件不可用(例如,未找到文件,没有访问权限)
我在网上查了不同的解决方案,而且大多数是说,这是由于写权限。我分配的FTP文件夹的写权限,但我仍然有问题。请帮助?
I've checked different solutions on the internet and most are saying that it is due to write permissions. I am assigning the ftp folder write permissions, but I am still having the problem. Please Help?
下面是我的code:
static void CreateFtpFolder(string source)
{
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(source);
request.Credentials = new NetworkCredential(ftpusername, ftppassword);
request.Method = WebRequestMethods.Ftp.MakeDirectory;
request.UsePassive = true;
request.UseBinary = false;
request.KeepAlive = false;
request.Proxy = null;
FtpWebResponse ftpResp = request.GetResponse() as FtpWebResponse;
}
我有关于误差 FtpWebResponse
。
推荐答案
您code看起来很好.......你是说你已经分配的权限了。 唯一的问题是,你可能会传递一个错误的源,这是造成problem..Check您的源字符串可能有一个错误......
Your code look fine.......you are saying that you have assigned permission too. The only problem is that you may be passing a wrong "Source"which is causing problem..Check your source string it may have an error......
路径应
WebRequest request = WebRequest.Create("ftp://host.com/directory123");
这意味着目录将与名为directory12创建 如果您要指定这样的路径
it mean directory will be created with name "directory12" if your are specifying path like this
WebRequest request = WebRequest.Create("ftp://host.com/directory123/directory1234");
这意味着 ftp://host.com/directory123/ 应该已经存在,新目录将被命名为directory1234创建 希望这将有助于
this mean "ftp://host.com/directory123/" should already exist and new directory will be created with name "directory1234" hope it will help
这篇关于远程服务器返回错误:(550)文件不可用(错误发生于使ftp目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!