locked
The underlying connection was closed: An unexpected error occurred on a receive.System.Exception {System.Net.WebException} RRS feed

  • Question

  • Hi,

    I am downloading latest files from FTp server using .net console application.While downloading the files from FTP server some times i am getting the error "underlying connection was closed: An unexpected error occurred on a receive".

    request.Timeout = 10000000;

     

     request.ReadWriteTimeout = 10000000;

    i used these statements also.Even though i am getting the same error.

    Please help me in this.

    thank you very much in advance.

    Wednesday, June 30, 2010 6:34 PM

Answers

All replies

  • Hi,

       Thanks for your post. Some claims that it's due to a bug in .net that closes the connection prior to it being finished according to here. I would suggest you use a WireShark (a sniffer) to check if the connection is closed before you trying to use it again. There're bunch of similar discussions over the web, below are some:

       1. The underlying connection was closed

           http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/49b8caff-0cfc-4347-aeb6-00142427da7b

        2. Solving "The underlying connection was closed: An unexpected error occurred on a send." (Webservices)

            http://weblogs.asp.net/jan/archive/2004/01/28/63771.aspx

        3. FIX: Intermittent "Underlying connection was closed" error message when you call a Web service from ASP.NET

            http://support.microsoft.com/kb/819450


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Marked as answer by SamAgain Thursday, July 8, 2010 6:31 AM
    Thursday, July 1, 2010 3:24 AM
  • We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Please mark the right answer at right time.
    Thanks,
    Sam
    Thursday, July 8, 2010 6:32 AM