473,804 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FtpWebRequest issue with GetRequestStrin g

Hi all,

I am working on a service that uploads METAR weather information to the
National Weather Service FTP site. The service I'm authoring is hosted on a
Windows 200 server, and the NWS FTP host is on a Unix server. I'm using the
FtpWebRequest and FtpWebResponse classes to do the file uploading. I have
tested it without any errors at all uploading to an IIS FTP server hosted on
our network Most of the time it uploads without error to the NWS server.

However, it intermittently throws a ServerProtocolV iolation exception when
calling GetRequestStrea m on the NWS server. My research has indicated to me
that, first, I am doing everything necessary on the client side, including
setting the Request.Method to WebRequestMetho ds.Ftp.UploadFi le, setting the
transfer type to ASCII, using an ASCII-encoded byte stream, and am using
PASV mode. It connects and authenticates with the server just fine. In fact,
it does everything else without incident, and as I mentioned before, usually
works without error.

I Googled the issue for a couple of hours, and found some references to a
possible issue with an incorrect Response Header. I was not able to confirm
this, however, and I'm not sure that this is the issue.

I also noticed that the HttpWebRequest has apparently had some issues with
Response headers that don't comply with the latest RFC, and a configuration
setting that disables exceptions for this particular issue when needed.
However, I couldn't find a similar configuration setting, or a property of
the FtpWebRequest that corresponded. Still, I'm not sure that this is the
issue, as I can't dig deep enough into the class structure to confirm this.

The following is the EventLog entry that my app writes when the exception
occurs. I haven't yet implemented a method for dissecting the
ServerProtocolV iolation exception, but that is my next step:

Exception of Type "System.Net.Web Exception"

The underlying connection was closed: The server committed a protocol
violation.
ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051016072548.txt
Status: ServerProtocolV iolation
StackTrace:
at System.Net.FtpW ebRequest.SyncR equestCallback( Object obj)
at System.Net.FtpW ebRequest.Reque stCallback(Obje ct obj)
at System.Net.Comm andStream.Abort (Exception e)
at System.Net.FtpW ebRequest.Finis hRequestStage(R equestStage stage)
at System.Net.FtpW ebRequest.GetRe questStream()
at DsiGlobal.Net.F tpClient.Upload File(Byte[] fileContents, String name,
String& ResponseInfo, TimeSpan& ts)

The underlying connection was closed: The server committed a protocol
violation.
ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051016072548.txt
Status: ServerProtocolV iolation.

I turned on Network Tracing so that I could see exactly where the exception
occurs, and perhaps find out why, but I am not able to discern this from the
trace. The following is a fragment of the Trace Log:

System.Net Verbose: 0 : [0972]
WebRequest::Cre ate(ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051015201816.txt)
System.Net Information: 0 : [0972]
FtpWebRequest#1 7653682::.ctor(ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051015201816.txt)
System.Net Verbose: 0 : [0972] Exiting WebRequest::Cre ate() ->
FtpWebRequest#1 7653682
System.Net Verbose: 0 : [0972] FtpWebRequest#1 7653682::GetReq uestStream()
System.Net Information: 0 : [0972]
FtpWebRequest#1 7653682::GetReq uestStream(Meth od=STOR.)
System.Net Information: 0 : [0972] Associating FtpWebRequest#1 7653682 with
FtpControlStrea m#42194754
System.Net Information: 0 : [0972] FtpWebRequest#1 7653682::(Relea sing FTP
connection#4219 4754.)
System.Net Error: 0 : [0972] Exception in the
FtpWebRequest#1 7653682::GetReq uestStream - The underlying connection was
closed: The server committed a protocol violation.
System.Net Error: 0 : [0972] at
System.Net.FtpW ebRequest.SyncR equestCallback( Object obj)
at System.Net.FtpW ebRequest.Reque stCallback(Obje ct obj)
at System.Net.Comm andStream.Abort (Exception e)
at System.Net.FtpW ebRequest.Finis hRequestStage(R equestStage stage)
at System.Net.FtpW ebRequest.GetRe questStream()
System.Net Verbose: 0 : [0972] Exiting
FtpWebRequest#1 7653682::GetReq uestStream()

That's about all I can provide. Any ideas?

--
TIA,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.


Nov 17 '05 #1
0 3572

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

Similar topics

7
16222
by: jose.lopes.cruz | last post by:
I need to access a FTP Server. I'm using FTPWebRequest as described in visual studio 2005 documentation. Everything works fine except the following: 1) I dont know how to change de current working directory on the server to the parent directory? 2) Why cant I do this, or why doesn't work? In Internet explorer works! <some code...for FtpWebRequest>
3
1981
by: Sputnik | last post by:
If I create an MFC application in Visual Studio 6 using the following code: CInternetSession inet_session; CFtpConnection *ftp_connection; ftp_connection = inet_session.GetFtpConnection( "Integration300", "guest", "ihannah", 21,TRUE); CString CurrentDirectory;
3
9719
by: Kevien Lee | last post by:
hi everyone I have a quick question when i use the FtpWebRequest. What I need to do is that: Connect a FTP server,check whether there is a folder if not,create it, then changed the path to the new folder If use the command line to do that,it just use the "CD" command can finish.But there is not the command in WebRequestMethods.Ftp
0
9803
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
6
9462
by: William LaMartin | last post by:
Could someone show me how to use the FtpWebRequest and change to a different directory? Changing directories is not listed as one of the methods, but I believe it can be done--just can't figure out how.
0
1102
by: RodeoClownCC | last post by:
Hello, I'm trying to create a simple FTP client using VB .NET's FTPWebRequest methods, and have unfortunately run into a snag. The problem I'm having is the client connects to an FTP server, and the FTP server sends the data routed through a different host. This does not seem to work with FTPWebRequest, as I keep getting a "The data connection was made from an address that is different than
2
1891
by: deciacco | last post by:
is there way to use the ftpwebrequest class to send the list -r command? thanks
9
3903
by: Waldy | last post by:
Hi there, I have written a service in VS2005 that downloads files from an FTP site processes them and then deletes the files if successfully processed. It all works fine when run in our test lab with an FTP site that I setup on IIS. However, I have an issue at the customer site. Their FTP server is on Linux, but I presume that is not an issue. What happened the first time I ran it was that it deleted every other file. It just so...
6
13694
by: Patrick.Simons | last post by:
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
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.