Error Message: Timed out trying to connect!

Jun 17, 2014 at 8:24 PM
FTP connection works on the local machine. When i try to deploy that to the server, i got the message and trace below:

My FTP Code:
FtpClient conn = new FtpClient();
conn.StaleDataCheck = false;
conn.Host = url;
conn.Credentials = new NetworkCredential(userName, passWord);
conn.SetWorkingDirectory(directory);

Error Message:
Timed out trying to connect!

Error Trace:
at System.Net.FtpClient.FtpSocketStream.Connect(String host, Int32 port, FtpIpVersion ipVersions)
in c:\Users\Joseph\Desktop\netftp\System.Net.FtpClient\FtpSocketStream.cs:line 605
at System.Net.FtpClient.FtpClient.Connect()
in c:\Users\Joseph\Desktop\netftp\System.Net.FtpClient\FtpClient.cs:line 802
at System.Net.FtpClient.FtpClient.Execute(String command)
in c:\Users\Joseph\Desktop\netftp\System.Net.FtpClient\FtpClient.cs:line 726
at System.Net.FtpClient.FtpClient.Execute(String command, Object[] args)
in c:\Users\Joseph\Desktop\netftp\System.Net.FtpClient\FtpClient.cs:line 684
at System.Net.FtpClient.FtpClient.SetWorkingDirectory(String path) in c:\Users\Joseph\Desktop\netftp\System.Net.FtpClient\FtpClient.cs:line 2321
Coordinator
Jun 17, 2014 at 8:44 PM
Post a transaction log, and by the way the Host property doesn't not accept URL's or URI's. It's the hostname only.
Jun 17, 2014 at 9:51 PM
The URI is fine. That parameter brings the URI. Like i said, it works on the local machine. What is the transaction log in this case? I know it is a stupid question, but i usually catch the error message and trace. Never did a transaction log.
Jun 17, 2014 at 9:51 PM
The URI is fine. That parameter brings the URI. Like i said, it works on the local machine. What is the transaction log in this case? I know it is a stupid question, but i usually catch the error message and trace. Never did a transaction log.
Jun 17, 2014 at 9:52 PM
Sorry about the duplication of the reply. My screen didn't show that reply at the first place.
Coordinator
Jun 17, 2014 at 11:10 PM
Edited Jun 17, 2014 at 11:10 PM
Check the docs and the Debug.cs example. Also you're not understanding what I'm saying about URL's, URI's. This does not work:
ftpClient.Host = "ftp://foobar.com";
ftpClient.Host = new Uri("ftp://foobar.com");
This is the correct usage:
ftpClient.Host = "foobar.com";
Alternatively there are some static methods of FtpClient that will accept a URI as a parameter. I only mention this because in your example your variable is called url so I wanted to point out that a URL is not valid for the Host property of FtpClient.