是否存在可以将文件上载到SFTP(SSH FTP)服务器的免费.NET库,该服务器会抛出上载问题的异常并允许监视其进度?
需要使用SFTP客户端并希望在.NET Core 2.0应用程序中构建它.
我想知道SFTP是否已经是.NET标准2.0的一部分,还是我需要使用第三方库,例如SSH.NET?
是否有一个很好的库连接到SFTP服务器并保存/加载文件到那里?我试过谷歌,但有太多,所以我想我要求建议.它将用于Web应用程序......
谢谢 :-)
我正在寻找免费的SFTP客户端.此外,它应该有一个免费的DLL,使用它我可以编写代码来上传和下载C#(.NET框架)文件.
例如以下代码不是免费的,它有30天免费评估,我想免费,
Chilkat.SFtp sftp = new Chilkat.SFtp();
bool success;
success = sftp.UnlockComponent("Anything for 30-day trial");
sftp.ConnectTimeoutMs = 5000;
sftp.IdleTimeoutMs = 10000;
int port;
string hostname;
hostname = "www.my-ssh-server.com";
port = 22;
success = sftp.Connect(hostname,port);
success = sftp.AuthenticatePw("myLogin","myPassword");
success = sftp.InitializeSftp();
string handle;
handle = sftp.OpenFile("hamlet.xml","readOnly","openExisting");
success = sftp.DownloadFile(handle,"c:/temp/hamlet.xml");
success = sftp.CloseHandle(handle);
MessageBox.Show("Success.");
Run Code Online (Sandbox Code Playgroud) 我使用 SharpSSH .NET 库进行 SFTP。
http://www.tamirgal.com/blog/page/sharpssh.aspx
当我尝试连接服务器时出现错误
算法协商失败

但当尝试通过 FileZilla 连接时,它可以正常工作。
我发现一些有相同的错误,但我不知道如何解决这个问题。
就像这里: http: //www.samhohce.net/questions/30190272/jsch-algorithm-negotiation-fail
我需要创建一个C#应用程序,根据app.config文件中输入的设置(使用"ftp\ftps\sftp")将excel文件上传到"FTP/SFTP"服务器.
我很满意这些协议,有很多疑点.
代码如下:
string PureFileName = new FileInfo(fileName).Name;
string uploadUrl = String.Format("ftp://{0}/{1}", ftpurl, PureFileName);
FtpWebRequest req = (FtpWebRequest)FtpWebRequest.Create(uploadUrl);
req.Proxy = null;
req.Method = WebRequestMethods.Ftp.UploadFile;
req.Credentials = new NetworkCredential(user, pass);
req.UseBinary = true;
req.UsePassive = true;
byte[] data = File.ReadAllBytes(fileName);
req.ContentLength = data.Length;
Stream stream = req.GetRequestStream();
stream.Write(data, 0, data.Length);
stream.Close();
FtpWebResponse res = (FtpWebResponse)req.GetResponse();
Run Code Online (Sandbox Code Playgroud)
是否喜欢url从FTP 更改为FTPS?
string uploadUrl = String.Format("ftps://{0}/{1}", ftpurl, PureFileName);
Run Code Online (Sandbox Code Playgroud) 我正在尝试连接到 SFTP 服务器来下载一些文件。代码是用 C# 编写的,我使用 FluentFTP 连接到 FTP。客户端将端口指定为 22。但是当我尝试以下代码时,出现错误
由于数据包格式异常,握手失败
任何使用 FluentFTP 的人都可以建议我代码中缺少的内容。
FtpClient fclient = new FtpClient("xxx.yyy.com", "username", "password");
fclient.EncryptionMode = FtpEncryptionMode.Implicit;
fclient.SslProtocols = SslProtocols.Tls12;
fclient.Port = 22;
fclient.Connect();
Run Code Online (Sandbox Code Playgroud)
谢谢。