我收到错误“远程服务器返回错误:(550)文件不可用(例如,文件未找到,无法访问)。”当我调用我的函数sendFile2FTP
Function sendFile2FTP(fileNameLocal As String, fileNameServer As String, user As String, password As String) As String
Dim ftpRequest As Net.FtpWebRequest = Net.WebRequest.Create(fileNameServer)
ftpRequest.Credentials = New Net.NetworkCredential(user, password)
ftpRequest.Method = Net.WebRequestMethods.Ftp.UploadFile
Try
Dim ficheiro() As Byte = System.IO.File.ReadAllBytes(fileNameLocal)
Dim ftpStream As System.IO.Stream = ftpRequest.GetRequestStream()
ftpStream.Write(ficheiro, 0, ficheiro.Length)
ftpStream.Close()
ftpStream.Dispose()
Return "True"
Catch ex As Exception
Return ex.Message
End Try
End Function
这是我发送给函数的参数(都是有效的)
fileNameLocal - > C:\ Users \ user \ Documents \ Visual Studio 2013 \ Projects \ AgenteExportDebitosCC \ AgenteExportDebitosCC \ bin \ Debug \ file02-05-2014.xml
fileNameServer - > ftp://ftp.server.com/intranet/file02-05-2014.xml
用户 - >用户密码 - >密码
我做错了什么?
编辑:
我不确定这是否是权限问题,但我可以使用相同的凭据创建带有filezilla的文件...
答案 0 :(得分:2)