我在本地计算机上使用IIS来测试FTP连接.我正在使用FluentFTP库连接到FTP.我使用以下代码连接到服务器.
FtpClient conn = new FtpClient();
conn.Host = firewallSslDetails.Address;
conn.Credentials = new NetworkCredential(firewallSslDetails.UserName, firewallSslDetails.Password);
conn.SslProtocols = System.Security.Authentication.SslProtocols.Default;
X509Certificate2 cert = new X509Certificate2(@"C:\Users\BizTalk360\Desktop\FtpSites\ServerCert.cer");
conn.EncryptionMode = FtpEncryptionMode.Implicit;
conn.DataConnectionType = FtpDataConnectionType.AutoActive;
conn.DataConnectionEncryption = true;
conn.EnableThreadSafeDataConnections = false;
conn.ClientCertificates.Add(cert);
conn.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
conn.Connect();
Run Code Online (Sandbox Code Playgroud)
服务器返回我有以下错误.
FluentFTP.FtpCommandException:策略需要SSL.Win32错误:访问被拒绝.错误详细信息:SSL策略要求SSL用于控制通道.
对于通过FTP连接,上面的代码工作正常,对于使用SSL的FTP,它无法正常工作.
我在 Azure 中运行 Windows Server 2012,并在 IIS 中配置了 FTP 服务器。当我尝试连接服务器时,它接受用户名和密码并让我登录,但不显示目录列表。
我试过使用 FileZilla FTP 客户端进行连接,但它说同样的错误。
Status: Resolving address of jothiprakashanandan.southindia.cloudapp.azure.com
Status: Connecting to 104.211.244.241:21...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is current directory.
Command: TYPE I
Response: 200 Type set to I.
Command: PASV
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory …Run Code Online (Sandbox Code Playgroud)