0
我按照official guide來整理FTP,但我的C#服務器不能再使用FTP與我的網絡服務器,我沒有編輯任何代碼。我有另一臺服務器使用相同的FTP方法,並且它不受影響(直到現在我才轉移到Cloudflare之前還沒有停止運行)。Cloudflare阻止FTP
有誰知道我需要在Cloudflare中通過C#啓用FTP嗎?
FileZilla在同一臺機器上工作正常 - 但一分鐘左右後就會超時。
如果相關的,這是我使用的是什麼:
Console.WriteLine("Uploading");
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://domain.tld/file.json");
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("username", "password");
StreamReader sourceStream = new StreamReader("file.json");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream(); //It gets stuck on this line
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
Console.WriteLine("Uploaded");
具有與服務器的IP,你累了連接 相同的源而不是你的域名?這樣你就可以一起繞過Cloudflare ......如果你擔心安全問題,那麼使用SFTP而不是FTP就不需要通過它們。 –
@SimonHayter我嘗試過'「ftp://ip.ip.ip.ip:21/file.json」',但沒有成功,我也無法通過我的Web主機提供的IP使用FTP與FileZilla。 – Skylark
那麼你很可能有一個服務器端問題或你的編程。檢查/ var/log中的日誌 –