Re: Underlying Connection Was Closed Error



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



.



Relevant Pages

  • Re: How do Large Scale Web Service Applications Maintain Session State?
    ... cache these profiles on the server in order to increase performance. ... which is something different than stateful Web Service classes. ... We do pass a session token as ... Having systems deployed through web services allows clients to access via ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: DataTable returned from a Web Service
    ... Most of my clients are .NET, in fact one is a VB6 client and I was able to convert a DataTable within a DataSet to a classic ADO Recordset and works perfectly. ... Funny thing is that with my VB6 client I can use the web service function that returns a DataTable but not my 'new' .Net clients. ... when using VS 2005 or VB.Net 2005 Express and creating a web references is ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Web service Performance
    ... clients are using it to synchronize some datas from clients database to ... server database, so they are calling web service methods very often. ... everything is restarting and queries response are going ...
    (microsoft.public.dotnet.framework.webservices)
  • Need advice on security setup
    ... Business Services layer will be implemented as XML Web Services. ... There will be several "clients" to the service layer. ... I need to authenticate each request to my services layer, ... credentials in the web service request, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: Netbios name resolution problem
    ... I am assuming that the clients are pointing ONLY to the WINS server you are ... servers to see if the record exists there also. ... Install Network Monitor in Windows 2000 ...
    (microsoft.public.win2000.networking)