【问题标题】:An error occurred while making the HTTP request to https -> Handshake failed向 https 发出 HTTP 请求时出错 -> 握手失败
【发布时间】:2014-11-05 18:53:38
【问题描述】:

我正在使用basicHttpsbinding 来使用 Web 服务,如下所示

 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();
    }

消费站点托管在 IIS 7.5 上,并且在服务器上有多个站点。我正在使用 .net 表单站点,调用代码如下所示

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

运行此服务时会返回结果约 15 分钟,然后开始出现此错误。

向 https://{siteName}/{service}/ 发出 HTTP 请求时出错。这可能是由于在 HTTPS 情况下未使用 HTTP.SYS 正确配置服务器证书。这也可能是由于客户端和服务器之间的安全绑定不匹配造成的

底层连接已关闭:发送时发生意外错误。 ---> System.IO.IOException: 由于意外的数据包格式,握手失败。

如果我回收该站点的应用程序池,该服务会在大约 15 分钟内再次开始返回结果,然后再次开始失败。我的应用程序池没有内存限制。

app.config 看起来像

<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>

【问题讨论】:

    标签: c# wcf basichttpbinding


    【解决方案1】:

    这个问题的答案在帖子“How do I disable SSL fallback and use only TLS for outbound connections in .NET? (Poodle mitigation)”中找到。我有其他 Web 服务调用正在设置以下代码而没有回退

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

    我必须将协议类型设置为 TLS,如回答帖子中所述。

    【讨论】:

      猜你喜欢
      • 2015-05-19
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多