Unable to get server's error response when uploading file with httpWebRequest - by IvanP_CBL

Status : 

 


2
0
Sign in
to vote
ID 779622 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 2/20/2013 8:13:42 AM
Access Restriction Public

Description

Uploading a file using HttpWebRequest requires to call GetRequestStream() and then Write() to the returned stream.
If there was a valuable delay between GetRequestStream() and actual writing to this stream a server may respond with "400: Bad request" error (on server's timeout) and then close connection (without waiting for the rest of data) .

This leads to IOException on requestStream.Write() with the following message: "Unable to write data to the transport connection: An established connection was aborted by the software in your host machine." 

This message is not informative for a client, and it looks like there's something on a client's side closed the connection, while it was a server who sent TCP FIN  packet.

At this point it's impossible to get server's response and understand the real reason of error.

Working example for repro is attached (MS visible only)
Network capture is attached
Sign in to post a comment.
Posted by Thomas Levesque on 2/21/2015 at 12:58 PM
It would really be nice to have a response from Microsoft about this... This is a major issue; at my company it forces us to design our web APIs in a very convoluted way to work around the issue (e.g., send a specific request to get the response for a failed upload).
Posted by Thomas Levesque on 11/18/2014 at 11:29 AM
I have exactly the same problem. This is a very serious problem, because the server does send a response, which I need to determine the cause of the error, and all I can see is a SendFailure...

> We regret to say that we are unable to take this request at this time.

What does that mean? Is the current behavior by-design? Will it be fixed at a later time? Is there a workaround?
Please give more details...
Posted by Microsoft on 4/5/2013 at 5:03 PM
We regret to say that we are unable to take this request at this time.
Posted by Microsoft on 2/26/2013 at 4:24 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 2/21/2013 at 1:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)