Halli Hallo,
ich nutze die Lib: github.com/robinrodricks/FluentFTP
Dort habe ich bei Issues schon ein ding offen weil ich denke es hat was mit der Lib zu tun
ABER ich dachte ich frage jetzt hier trotzdem nochmal nach ob ich was falsch mache.
Der Log/Ausgabe der Lib mit der Exception sieht so aus:
Spoiler anzeigen
Der Code dazu:
Spoiler anzeigen
Die Exception kommt in Zeile 12 und sieht so aus:
Spoiler anzeigen
Irgendwas stimmt da nicht. Ich kann es mir nicht erklären. Es ist genau DER eine FTP Server bei dem es nicht klappt. Alle anderen die ich getestet habe da funktioniert alles einwandfrei.
Habt ihr ne Idee?
ich nutze die Lib: github.com/robinrodricks/FluentFTP
Dort habe ich bei Issues schon ein ding offen weil ich denke es hat was mit der Lib zu tun
ABER ich dachte ich frage jetzt hier trotzdem nochmal nach ob ich was falsch mache.
Der Log/Ausgabe der Lib mit der Exception sieht so aus:
Quellcode
-
- # OpenPassiveDataStream(PASV, "STOR /testfile", 0)
- Command: PASV
- Response: 227 Entering Passive Mode (xx,xx,xx,xxx,xx,xx,xxxx)
- Status: Connecting to xx.xx.xx.xx:36043
- Command: STOR /testfile
- Response: 150 Accepted data connection
- Status: FTPS Authentication Successful
- Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0,4012219.
- Ausnahme ausgelöst: "System.Net.Sockets.SocketException" in System.dll
- "xxxx.exe" (CLR v4.0.30319: xxxx.exe): "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_de_b77a5c561934e089\System.resources.dll" geladen. Das Modul wurde ohne Symbole erstellt.
- Ausnahme ausgelöst: "System.IO.IOException" in System.dll
- Status: Disposing FtpSocketStream...
- Ausnahme ausgelöst: "System.Net.Sockets.SocketException" in System.dll
- Ausnahme ausgelöst: "System.IO.IOException" in System.dll
- Ausnahme ausgelöst: "System.ObjectDisposedException" in System.dll
- # OpenAppend("/testfile", Binary)
- # GetFileSize("/testfile")
- Command: SIZE /testfile
- Ausnahme ausgelöst: "System.NullReferenceException" in FluentFTP.dll
- Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Der Code dazu:
C#-Quellcode
- using (FtpClient conn = new FtpClient(Config.Default.FTPHost, Config.Default.FTPPort, Config.Default.FTPUser, Config.Default.FTPPassword))
- {
- conn.EncryptionMode = FtpEncryptionMode.Auto;
- conn.ValidateAnyCertificate = true;
- conn.SslProtocols = SslProtocols.Default | SslProtocols.Tls11 | SslProtocols.Tls12;
- conn.RetryAttempts = 3;
- conn.DataConnectionType = FtpDataConnectionType.PASV;
- conn.Connect();
- foreach (FileInfo file in files)
- {
- var result = conn.UploadFile(file.FullName, $"{Config.Default.FTPPath}{file.Name}", FtpRemoteExists.Overwrite, false, FtpVerify.Retry);
- if (result.IsFailure())
- {
- Console.WriteLine($"{file} not uploaded.");
- }
- }
- }
Die Exception kommt in Zeile 12 und sieht so aus:
Quellcode
- Error while uploading the file to the server. See InnerException for more info
- bei FluentFTP.FtpClient.UploadFileInternal(Stream fileData, String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, Action`1 progress, FtpProgress metaProgress)
- bei FluentFTP.FtpClient.UploadFileFromFile(String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, FtpVerify verifyOptions, Action`1 progress, FtpProgress metaProgress)
- bei FluentFTP.FtpClient.UploadFile(String localPath, String remotePath, FtpRemoteExists existsMode, Boolean createRemoteDir, FtpVerify verifyOptions, Action`1 progress)
- System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
- bei FluentFTP.FtpExtensions.IsKnownError(String reply, String[] strings)
- bei FluentFTP.FtpClient.GetFileSizeInternal(String path, FtpSizeReply sizeReply)
- bei FluentFTP.FtpClient.GetFileSize(String path)
- bei FluentFTP.FtpClient.OpenAppend(String path, FtpDataType type, Boolean checkIfFileExists)
- bei FluentFTP.FtpClient.UploadFileInternal(Stream fileData, String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, Action`1 progress, FtpProgress metaProgress)
Irgendwas stimmt da nicht. Ich kann es mir nicht erklären. Es ist genau DER eine FTP Server bei dem es nicht klappt. Alle anderen die ich getestet habe da funktioniert alles einwandfrei.
Habt ihr ne Idee?