Skip to content

FTPS throwing exception - An existing connection was forcibly closed by the remote host #25

@kanikantik

Description

@kanikantik

Hi,

I am using Cerberus FTP server on Azure VM. When I user Filezilla client to connect to server over FTPS its working fine.

When I use the below code it is throwing the error mentioned in the subject line
using (var ftpClient = new FtpClient(FtpProtocol.FtpS,"xx.xx.xxx.xx",990, new NetworkCredential("tenantuser1","tenantuser1")))
{
IEnumerable files = ftpClient.ListEntries("/");
}
Here is the stack trace

at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at ArxOne.Ftp.FtpSession.UpgradeToSsl(Stream stream)
at ArxOne.Ftp.FtpSession.CreateDataStream(Socket socket)
at ArxOne.Ftp.IO.FtpPassiveStream.SetSocket(Socket socket)
at ArxOne.Ftp.IO.FtpPassiveStream..ctor(Socket socket, FtpSession session)
at ArxOne.Ftp.FtpSession.OpenDirectPassiveDataStream(String host, Int32 port, TimeSpan connectTimeout, TimeSpan readWriteTimeout)
at ArxOne.Ftp.FtpSession.OpenPassiveDataStream(TimeSpan connectTimeout, TimeSpan readWriteTimeout)
at ArxOne.Ftp.FtpSession.OpenDataStream(Boolean passive, TimeSpan connectTimeout, TimeSpan readWriteTimeout, FtpTransferMode mode)
at ArxOne.Ftp.FtpClientUtility.OpenDataStream(FtpSession session, FtpTransferMode mode)
at ArxOne.Ftp.FtpClientUtility.ProcessList(FtpSession session, FtpPath path)
at ArxOne.Ftp.FtpClientUtility.<>c__DisplayClass1_0.b__0(FtpSession handle)
at ArxOne.Ftp.FtpClient.Process[TResult](Func`2 action, FtpSession session)
at ArxOne.Ftp.FtpClientUtility.List(FtpClient ftpClient, FtpPath path)
at ArxOne.Ftp.FtpClientUtility.ListEntries(FtpClient ftpClient, FtpPath path)
at FTPTestAppConsole.Program.DownloadDirectory(FtpClient client, String source, String destination) in c:\Users\kkanikanti\Documents\Visual Studio 2013\Projects\FTPTestApp\FTPTestAppConsole\Program.cs:line 29
at FTPTestAppConsole.Program.Main(String[] args) in c:\Users\kkanikanti\Documents\Visual Studio 2013\Projects\FTPTestApp\FTPTestAppConsole\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Let me know if I have to specify any certificate for FTPS.

Thanks,
Krishna Priya

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions