【发布时间】:2016-12-20 09:40:23
【问题描述】:
我很难理解这个错误的概念,因为我有以下信息:
' Year (For Folder Name)
Dim Year As String
Year = Date.Today.Year
' Month (For Folder Name)
Dim Month1 As String
Month1 = MonthName(Month(Now()), False)
' Current Date (For File Name)
Dim todaysDate As String
todaysDate = Date.Now.ToString("dd-MM-yyyy")
Dim request As System.Net.FtpWebRequest =
DirectCast(System.Net.WebRequest.Create(
"directory" + Year + "\" + Month1 + "\" + todaysDate + ".csv"),
System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("user", "password")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Console.WriteLine("Connected Successfully")
Dim file() As Byte = System.IO.File.ReadAllBytes(
"directory" + Year + "\" + Month1 + "\" + todaysDate + ".csv")
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
错误发生在以下行:
Dim strz As System.IO.Stream = request.GetRequestStream()
错误:
远程服务器返回错误:(550) 文件不可用(例如, 找不到文件,无法访问)VB.NET 错误
我输入的所有信息都是正确的,我只是在努力理解为什么这是错误的,因为我在网上找到了这个,其他人似乎都推荐它。如果有什么可以向我解释为什么?
【问题讨论】:
标签: .net vb.net ftp ftpwebrequest