472,805 Members | 3,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

FtpWebRequest issue with GetRequestString

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 ServerProtocolViolation exception when
calling GetRequestStream 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 WebRequestMethods.Ftp.UploadFile, 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
ServerProtocolViolation exception, but that is my next step:

Exception of Type "System.Net.WebException"

The underlying connection was closed: The server committed a protocol
violation.
ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051016072548.txt
Status: ServerProtocolViolation
StackTrace:
at System.Net.FtpWebRequest.SyncRequestCallback(Objec t obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(Reques tStage stage)
at System.Net.FtpWebRequest.GetRequestStream()
at DsiGlobal.Net.FtpClient.UploadFile(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: ServerProtocolViolation.

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::Create(ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051015201816.txt)
System.Net Information: 0 : [0972]
FtpWebRequest#17653682::.ctor(ftp://205.156.51.29/T_Dsi_101_C_KWBC_20051015201816.txt)
System.Net Verbose: 0 : [0972] Exiting WebRequest::Create() ->
FtpWebRequest#17653682
System.Net Verbose: 0 : [0972] FtpWebRequest#17653682::GetRequestStream()
System.Net Information: 0 : [0972]
FtpWebRequest#17653682::GetRequestStream(Method=ST OR.)
System.Net Information: 0 : [0972] Associating FtpWebRequest#17653682 with
FtpControlStream#42194754
System.Net Information: 0 : [0972] FtpWebRequest#17653682::(Releasing FTP
connection#42194754.)
System.Net Error: 0 : [0972] Exception in the
FtpWebRequest#17653682::GetRequestStream - The underlying connection was
closed: The server committed a protocol violation.
System.Net Error: 0 : [0972] at
System.Net.FtpWebRequest.SyncRequestCallback(Objec t obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(Reques tStage stage)
at System.Net.FtpWebRequest.GetRequestStream()
System.Net Verbose: 0 : [0972] Exiting
FtpWebRequest#17653682::GetRequestStream()

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 3468

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

Similar topics

7
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...
3
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(...
3
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...
0
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...
6
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...
0
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,...
2
by: deciacco | last post by:
is there way to use the ftpwebrequest class to send the list -r command? thanks
9
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...
6
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.