locked
Solution to "Underlying connection was closed:Received an unexpected EOF or 0 bytes from the transport stream"

    General discussion

  • Hello,

    I used to have this problem and there where no answer in this forums, as a

    contribution to the community i will document what worked for me, for all of you:

    Scenario:

    Local side: Asp.net 2.0 Web Service, IIS 6.0

    Remote side: Java Web Services, Apache, Local ssl certificate(https)

    Solution:

    In short, the problem was when the web service tried to connect to establish the ssl handshake, by default

    uses TLS and in this case the java web services was SSLv3, but the error never showed this in plain text.

    Trace:

    Proto      Info
    ====================================================================================================
    TCP       1400 > https [SYN] Seq=0 Ack=0 Win=65535 Len=0 MSS=1460
    TCP       1400 > https [ACK] Seq=1 Ack=0 Win=65535 Len=0
    TLS        Client Hello
    TCP       1400 > https [ACK] Seq=71 Ack=14 Win=65521 Len=0
    TCP       1400 > https [ACK] Seq=71 Ack=15 Win=65521 Len=0
    TCP       1400 > https [FIN, ACK] Seq=71 Ack=15 Win=65521 Len=0
    TCP       1401 > https [SYN] Seq=0 Ack=0 Win=65535 Len=0 MSS=1460
    .....
    Loop

    In order to config this you have set to:

    System.Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Ssl3

    After this the service will do the hand shake and continue, now the only point to resolve is how to set this options in the default "Add Web Reference"....

     

    Thursday, January 04, 2007 11:20 PM

All replies

  • Brilliant! That solved my problem. My application (.NET2.0 Win Form) worked before (it download a text file posted by a public services institution from a "https://...." source). After a few month not using it, it suddely stopped working with this exception. I am not sure what caused my computer change, it could be the installation of .NET3.0/3.5/2.0SP1, or it could be various windows update...

     

    Anyway, addiing the line of cose as you showed, my app get back on track. Thanks.

    Friday, January 25, 2008 6:20 PM
  • A huge "THANK YOU" for this.  Fixed it up nicely.

    Saturday, August 22, 2009 9:10 PM
  • thanks, works fine!!!!
     thanks thanks!
    ------------------
    Wednesday, November 25, 2009 6:12 PM