Can explicity ftps via Filezilla but not from code
As the title states, I can connect to another machine from my server via FileZilla Client, but I canno开发者_运维知识库t via code (.Net - FTPWebRequest)
I know the code is good, as it works from another machine. The particular machine I am having trouble with is behind a NAT, but the SA has opened all ports for traffic from the host we are trying to talk to.
Any suggestions - have I missed something obvious?
The exception I get from the attempted connection is:
"Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
And, the logs from the machine we are trying to connect show:
7/26/2010 12:40:23 PM - (not logged in) (xx.xx.xxx.xxx)> Connected, sending welcome message...
7/26/2010 12:40:23 PM - (not logged in) (xx.xx.xxx.xxx)> 220-FileZilla Server version 0.9.32 beta
7/26/2010 12:40:23 PM - (not logged in) (xx.xx.xxx.xxx)> 220 ftp.xxxxxxxxxx.com
7/26/2010 12:40:23 PM - (not logged in) (xx.xx.xxx.xxx)> AUTH TLS
7/26/2010 12:40:24 PM - (not logged in) (xx.xx.xxx.xxx)> 234 Using authentication type TLS
7/26/2010 12:41:24 PM - (not logged in) (xx.xx.xxx.xxx)> 421 Login time exceeded. Closing control connection.
7/26/2010 12:41:24 PM - (not logged in) (xx.xx.xxx.xxx)> disconnected.
Sorry I forgot to come back here with my solution - It was implicit vs explicit SSL. I was using implicit for the FileZilla use case but explicit for the FTPWebRequest. Unfortunately, FTPWebRequest doesn't support implicit and the NAT was having problems with explicit.
Long story short, we went with a FTPS control called Alex FTPS client that is easy to use for either implicit or explicit ssl, easy to setup, and works flawlessly.
Maybe, there is a problem in certificate, which server sends during TLS/SSL negotiation, i.e. it is not accepted by operating system, or so on. Try to run Wireshark to check, which data is actually sent between client and server.
Dim auth = New System.Net.NetworkCredential(userName, password)
sRet = ftps.Connect(sAddress, 990, auth, ESSLSupportMode.Implicit, AddressOf UF.ValidateServerCertificate, Nothing, 0, 0, 0, 600000, True
精彩评论