0
FTP 550 오류를 해결하는 방법 업로드하는 동안 잘못된 연결로 인해 "액세스가 거부되었습니다". 때로는 문제없이 업로드 할 수 있기 때문에 내 서버에서 이미 허가를 받았다고 확신합니다.업로드하는 동안 잘못된 연결로 인해 FTP 550 오류 "액세스가 거부되었습니다"를 해결하는 방법
public bool FTPUploadFunct(string uploadto2, string newskinlocation2)
{
bool FTPUploadFunct = true;
MethodInvoker methodInvokerDelegate = delegate()
{ toolStripStatusLabel1.Text = "Uploading...."; };
this.Invoke(methodInvokerDelegate);
try
{
//delete old file
FtpWebRequest requestFileDelete = (FtpWebRequest)WebRequest.Create(uploadto2);
requestFileDelete.Credentials = new NetworkCredential("FTPUser20", "1234");
requestFileDelete.Method = WebRequestMethods.Ftp.DeleteFile;
FtpWebResponse responseFileDelete = (FtpWebResponse)requestFileDelete.GetResponse();
//upload new file
FtpWebRequest requestFTPUploader = (FtpWebRequest)WebRequest.Create(uploadto2);
requestFTPUploader.Credentials = new NetworkCredential("FTPUser20", "1234");
requestFTPUploader.Method = WebRequestMethods.Ftp.UploadFile;
FileInfo fileInfo = new FileInfo(newskinlocation2);
FileStream fileStream = fileInfo.OpenRead();
int bufferLength = 2048;
byte[] buffer = new byte[bufferLength];
Stream uploadStream = requestFTPUploader.GetRequestStream();
int contentLength = fileStream.Read(buffer, 0, bufferLength);
while (contentLength != 0)
{
backgroundWorker1.ReportProgress((int)(contentLength/fileInfo.Length));
uploadStream.Write(buffer, 0, contentLength);
contentLength = fileStream.Read(buffer, 0, bufferLength);
}
uploadStream.Close();
fileStream.Close();
backgroundWorker1.ReportProgress(100);
requestFTPUploader = null;
}
catch (WebException ex)
{
FTPUploadFunct = false;
String status = ((FtpWebResponse)ex.Response).StatusDescription;
MessageBox.Show(status + "error while in FTPUploadFunc");
errorNumber = (int)((FtpWebResponse)ex.Response).StatusCode;
if (errorNumber == 550)
{
MessageBox.Show("550" + "error while in FTPUploadFunc2");
};
}
return FTPUploadFunct;
}
이 붙어 많은 시간 : 누군가가이 문제를 여기 저기
내 코드입니다 해결할 수 있습니다 내가 몇 가지 게시물을 읽을 것 서버가 연결 속도가 느린 도착했기 때문에 이런 일이 있다고하지만 난 알고 싶어requestFileDelete.Method = WebRequestMethods.Ftp.DeleteFile;
하지만 언젠가에서
requestFTPUploader.Method = WebRequestMethods.Ftp.UploadFile;