473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

FtpWebRequest: ListDirectoryDetails with "Unable to connect to theremote server"

I try to connect a FTPWebRequest through Proxy and VPN to a remote
FTP- server. Sometimes it works sometimes not. When my VB.Net-App
(2005) returns the error on the GetResponse-Method, I'll try to use
the Windows Explorer to go on the FTP-URI and this always works. So
the problem should come from my app.

my simplified code:

Private m_oFTP As FtpWebRequest
Private oResponseDir As FtpWebResponse = Nothing

m_oFTP = FtpWebRequest.Create("ftp://" & m_sFTPIP & "//" &
m_sNetTraDir & "/*.TRA") With m_oFTP
.Credentials = New NetworkCredential(m_sFTPUsr, m_sFTPPwd)
.UseBinary = True
.KeepAlive = True
.Method = WebRequestMethods.Ftp.ListDirectoryDetails
Try
oResponseDir = .GetResponse()
bRc = True
Catch ex As Exception
....
End With

The trace file shows this:

System.Net Verbose: 0 : [3956] WebRequest::Create(ftp://10.70.5.19//
EXPORT/FTP_E02/*.TRA)
System.Net Information: 0 : [3956]
FtpWebRequest#64923656::.ctor(ftp://
10.70.5.19//EXPORT/FTP_E02/*.TRA)
System.Net Verbose: 0 : [3956] Exiting WebRequest::Create() ->
FtpWebRequest#64923656
System.Net Verbose: 0 : [3956] FtpWebRequest#64923656::GetResponse()
System.Net Information: 0 : [3956]
FtpWebRequest#64923656::GetResponse(Method=LIST.)
System.Net Warning: 0 : [3956] WebProxy failed to autodetect a Uri for
a proxy script.
System.Net Warning: 0 : [3956] WebProxy failed to autodetect a Uri for
a proxy script.
System.Net Error: 0 : [3956] Exception in the
FtpWebRequest#64923656::GetResponse - Unable to connect to the remote
server
System.Net Error: 0 : [3956] at
System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [3956] Exiting
FtpWebRequest#64923656::GetResponse()
Any ideas...
Sep 24 '08 #1
6 13631
Any guru's out there?
Oct 9 '08 #2
On Sep 24, 2:58*pm, "Patrick.Sim...@intecsoft.com"
<Patrick.Sim...@intecsoft.comwrote:
I try to connect a FTPWebRequest through Proxy and VPN to a remote
FTP- server. Sometimes it works sometimes not. When my VB.Net-App
(2005) returns the error on the GetResponse-Method, I'll try to use
the Windows Explorer to go on the FTP-URI and this always works. So
the problem should come from my app.

my simplified code:

Private m_oFTP As FtpWebRequest
Private oResponseDir As FtpWebResponse = Nothing

m_oFTP = FtpWebRequest.Create("ftp://" & m_sFTPIP & "//" &
m_sNetTraDir & "/*.TRA") With m_oFTP
* * * .Credentials = New NetworkCredential(m_sFTPUsr, m_sFTPPwd)
* * * .UseBinary = True
* * * .KeepAlive = True
* * * .Method = WebRequestMethods.Ftp.ListDirectoryDetails
* * * Try
* * * * * oResponseDir = .GetResponse()
* * * * * bRc = True
* * * Catch ex As Exception
* * * *....
End With

The trace file shows this:

System.Net Verbose: 0 : [3956] WebRequest::Create(ftp://10.70.5.19//
EXPORT/FTP_E02/*.TRA)
System.Net Information: 0 : [3956]
FtpWebRequest#64923656::.ctor(ftp://
10.70.5.19//EXPORT/FTP_E02/*.TRA)
System.Net Verbose: 0 : [3956] Exiting WebRequest::Create() * * ->
FtpWebRequest#64923656
System.Net Verbose: 0 : [3956] FtpWebRequest#64923656::GetResponse()
System.Net Information: 0 : [3956]
FtpWebRequest#64923656::GetResponse(Method=LIST.)
System.Net Warning: 0 : [3956] WebProxy failed to autodetect a Uri for
a proxy script.
System.Net Warning: 0 : [3956] WebProxy failed to autodetect a Uri for
a proxy script.
System.Net Error: 0 : [3956] Exception in the
FtpWebRequest#64923656::GetResponse - Unable to connect to the remote
server
System.Net Error: 0 : [3956] * *at
System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [3956] Exiting
FtpWebRequest#64923656::GetResponse()

Any ideas...
Hi,
Just a guess as far as based on your code, it may a trouble because of
your application gets timed out due to absence of Timeout property.
You can try to set a enlarged FtpWebRequest.Timeout property (in
miliseconds) to test it.

http://msdn.microsoft.com/en-us/libr...t.timeout.aspx

Hope this helps,

Onur Güzel
Oct 9 '08 #3
It has nothing to do with the Timeout. When the property isn't set,
the timeout is infinite.

What could be the difference between using FtpWebRequest or using the
windows explorer (XP SP3)?

BTW: I use a VPN-connection....
Oct 13 '08 #4
On Oct 13, 5:44 pm, "Patrick.Sim...@intecsoft.com"
<Patrick.Sim...@intecsoft.comwrote:
It has nothing to do with the Timeout. When the property isn't set,
the timeout is infinite.

What could be the difference between using FtpWebRequest or using the
windows explorer (XP SP3)?

BTW: I use a VPN-connection....
Not sure, MSDN says:

"To specify an infinite value, set the Timeout property to Infinite
(-1). "

Thus, you "may" need to set:
System.Threading.Timeout.Infinite
Worth to try.

Onur Güzel
Oct 13 '08 #5
Yes indeed, the default value for the Timeout is not infinite, it's
100000 (100 ms).
But changing it to System.Threading.Timeout.Infinite doesn't change my
problem.

Any other thoughts?

Oct 14 '08 #6
I find a solution. It seems that the FTP-server doesn't always want to
answer the FtpWebRequest.GetResponse(), so I made some
pings in a loop to force the server to answer (in VB.Net with
System.Net.NetworkInformation.Ping). After I got the first positive
reply from the ping, the FtpWebRequest.GetResponse() worked fine.

Oct 20 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rotarinn | last post by:
Hi, I am using VisualStudio.NET 2003 trying to connect to an Oracle Database (version 8.0.5). I have created the connection using "Microsoft OleDBProvider for Oracle" and when I click on Test...
0
by: Unabogie | last post by:
"preiner" <preiner@newsgroup.nospam> wrote in message news:C2DF9EAC-36E1-457C-BEBF-87737CAC5103@microsoft.com... >I also had this problem. I called MS tech support and they had an internal >KB >...
12
by: Mikito Harakiri | last post by:
I wonder if WITH RECURSIVE MaryAncestor(anc,desc) AS ( (SELECT parent as anc, child as desc FROM ParentOf WHERE desc = "Mary") UNION (SELECT A1.anc, A2.desc FROM MaryAncestor A1, MaryAncestor...
4
by: Bruce A. Julseth | last post by:
This is my 2nd request. Is the question too vague? Or, too difficult to answer. I'm really a newbie at this VS.NET stuff and do appreciate some help on this problem.---I keep getting the error...
0
by: Lawanya | last post by:
In smart client application using emulator in .Net ,I have tried for datbase conenctivity.But system.data.sqlclient was not available.So i used webservices and connected to database in same...
2
by: a | last post by:
I keep getting this message, "unable to get the project file from the web server" when I try to open a new project that I just copied. I created a virtual director with IIS 5 (VS2002). Trying to...
2
by: Rossco | last post by:
I have a VB.NET serviced component (COM+), running on a lan, that calls out to an external web service to place an order with a supplier. The problem machine is the middle tier (COM+) for our in...
2
by: Peter Afonin | last post by:
Hello, I'm using CreateUserWizard control in ASP.NET 2.0. I'm storing the data in SQL Server 2005. The first and last steps run smoothly without any problems. But I added one middle step to...
3
by: cberthu | last post by:
Hi all, Is it possible to have two connects in the same rexx script to different DB's? I have to get data form on DB (with specifics selects and filter out some values with RExx) and save the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.