No connection could be made because the target machine actively refused it

Jan 3, 2010 at 7:55 PM

Hi Alessandro,

Happy New Year.

 

>> If this doesn't work, the "SslDataChannelCheckExplicitEncryptionRequest()" workaround is the way to go.

As per our previous discussion you suggested the above, and it seems to work ( no PROT P error now).

All I did was this -


//if (IsControlChannelEncrypted && !isImplicitSsl)
if (IsControlChannelEncrypted)

{
SslDataChannelCheckExplicitEncryptionRequest();

if ((sslSupportMode & ESSLSupportMode.ControlChannelRequested) != ESSLSupportMode.ControlChannelRequested)
SSlCtrlChannelCheckRevertToClearText();
}


However, I am getting the following error :-

 

No connection could be made because the target machine actively refused it   xx.xx.xx..xx.29007

And here is the exception :- An exception of type 'System.Net.Sockets.SocketException' occurred in System.dll but was not handled in user code

Additional information: No connection could be made because the target machine actively refused it.

 

Here is my code same as previous time.

Here is my code (vb.net) -

---------------------------------------------

Shared Function myCertificateValidation(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    
        Return True

   
    End Function

 

Private Shared Function useFTPTransfer(ByVal autoSessionID As Integer, ByVal MySchoolID As Integer, ByVal FTPURL As String, ByVal Path As String, ByVal filename As String, ByVal userName As String, ByVal password As String) As String

  Dim client As New FTPSClient()

client.Connect("Host Name", New NetworkCredential("user", "pass"), ESSLSupportMode.Implicit Or ESSLSupportMode.DataChannelRequested, New RemoteCertificateValidationCallback(AddressOf myCertificateValidation))

client.GetFile("/example1.txt", Path &  filename)

End Function

 

I have opened ports 21 and 990 in my firewall.

Please help.

 

Thank you.

 

 

 

 


Coordinator
Jan 3, 2010 at 10:28 PM

Hi,

happy new year :-)

No connection could be made because the target machine actively refused it   xx.xx.xx..xx.29007

This is a quite typical problem with FTP(S). FTP uses two connections: one for control messages and one for data traffic.

The second one is open on demand (in so called passive mode), to the given ip and port 29007 in your case (I assume that xx.xx.xx.xx is your correct server address).

Using clear FTP a firewall is able to inspect the packet and open the port on the fly. Using encryption this is of course no more possible.

 

The best way to proceed, is limiting the passive port range on the FTP server (e.g.: 29000 to 30000) and open this range on the firewall.

 

Cheers,

Alex

 

 

 

Jan 3, 2010 at 10:28 PM

Hi Alessandro,

My firewall was blocking it.

It works now.

 

Thank you.