Re: Underlying Connection Was Closed Error
- From: WeluR <WeluR@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 05:52:04 -0700
Hi Alex,
Thanks for the reply. Unfortunately, I'm working with remote clients that
don't have the expertise (or install rights) to use Network Monitor (the
application works great on my machine and I can't duplicate the error
locally).
However, I have implemented System.Net.Tracing (a very neat feature BTW) and
I can see all the HTTP traffic. It appears to make two CONNECT requests to
the proxy server and then tries to resubmit the web server request via a GET.
At that point it errors out with a closed connection. Somehow, the SSL
connection is not being maintained.
Thanks,
Ross
"Alex Meleta" wrote:
Hi WeluR,.
Yeah, Microsoft Network Monitor 3.1, works fine even on Vista )
http://www.microsoft.com/downloads/details.aspx?familyid=18b1d59d-f4d8-4213-8d17-2f6dde7d7aac&displaylang=en
Regards, Alex
[TechBlog] http://devkids.blogspot.com
I have a web client application built on .Net Frameworks 2.0 that
connects to
a web service on IIS 6.0 via SSL and using X509 Client Certificates.
At some
locations (it works at others), I get the following error. Below is
my code.
I've also used System.Net.Tracing and have the traffic generated as a
result
of the web request if anyone wants to view it.
System.Net.WebException: There was an error downloading
'https://web-site-url/web-service.asmx'. ---> System.Net.WebException:
The
underlying connection was closed: An unexpected error occurred on a
send.
---> System.IO.IOException: The handshake failed due to an unexpected
packet
format.
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32
readBytes, AsyncProtocolRequest asyncRequest)
... remainder ommitted for brevity.
THE CODE:
' Connect to Web Service
Dim metwebProxy As New CalAuthWs
Dim userProxy As IWebProxy
' Set certificate policy to ignore metweb certificate error
notifications ServicePointManager.ServerCertificateValidationCallback
= g_certificateValidationCallback
metwebProxy.PreAuthenticate = True
' Set Network Proxy Server depending on user selections
If String.Compare(My.Settings.UserProxy, m_PROXY_DEFAULT, True) = 0
Then
....userProxy = WebRequest.DefaultWebProxy
....If Not userProxy Is Nothing Then
........If My.Settings.UseDefaultCredentials Then
............userProxy.Credentials = CredentialCache.DefaultCredentials
........End If
........metwebProxy.Proxy = userProxy
....End If
ElseIf String.Compare(My.Settings.UserProxy, m_PROXY_USER_DEFINED,
True) = 0
Then
....' User has manual proxy server settings
....userProxy = Utilities.GetUserProxyServer
....If Not userProxy Is Nothing Then metwebProxy.Proxy = userProxy
End If
' Add client-side certificate
metwebProxy.ClientCertificates.Add(x509In)
' Test Connection
If metwebProxy.TestLogin(certificateSubject, ApplicationSource.AFCAV)
Then
....Return metwebProxy
Else
....' Web Service indicates system is down
....Dim status As String = metwebProxy.ServerStatus
....DisplayMessage(True, "Access Denied: WebAFCAV is currently not
available. Status: " & status)
....Return Nothing
End If
- References:
- Re: Underlying Connection Was Closed Error
- From: Alex Meleta
- Re: Underlying Connection Was Closed Error
- Prev by Date: Testing
- Next by Date: Event log error but Webservice works
- Previous by thread: Re: Underlying Connection Was Closed Error
- Next by thread: Testing
- Index(es):
Relevant Pages
|