An error occurred while making the HTTP request to https -> Handshake failed

RussHooker picture RussHooker · Nov 5, 2014 · Viewed 24.1k times · Source

I am consuming a webservice using a basicHttpsbinding as follows

 EXCClient CreateClient()
    {
        var binding = new System.ServiceModel.BasicHttpsBinding();
        binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
        binding.MaxReceivedMessageSize = int.MaxValue;
        binding.UseDefaultWebProxy = false;
        var endpoint = new System.ServiceModel.EndpointAddress("https://{siteName}/{service}");

        var client = new EXCClient(binding, endpoint);
        return client;
        //return new EXCClient();
    }

The consuming site is hosted on IIS 7.5 and has multiple sites located on the server. I am using .net forms site the calling code looks like the following

var x = service.Client.GetResults({parameter});

When running this service will return results for about 15 minutes and then begins to get this error.

An error occurred while making the HTTP request to https://{siteName}/{service}/. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server

The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: The handshake failed due to an unexpected packet format.

If I recycle the app pool for the site the service begins to return results again for about 15 minutes and then begins failing again. My app pool has no memory limitations put on it.

The app.config looks like

<bindings>
    <basicHttpBinding>
        <binding name="BasicHttpBinding_EXC">
            <security mode="Transport" />
        </binding>
        <binding name="BasicHttpBinding_EXC1" />
    </basicHttpBinding>
</bindings>
<client>
    <endpoint address="https://vadrs.tax.utah.gov/vdx/" binding="basicHttpsBinding"
        bindingConfiguration="BasicHttpBinding_EXC" contract="UTVehicleServices.EXC"
        name="BasicHttpBinding_EXC" />
</client>

Answer

RussHooker picture RussHooker · Nov 10, 2014

The answer to this question was found in the post "How do I disable SSL fallback and use only TLS for outbound connections in .NET? (Poodle mitigation)". I had other web service calls that were setting the following code with no fall back

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

I had to set the protocol type to TLS as mentioned in the answering post.