【问题标题】:BasicHttpBinding over Load Balancer SSL Endpoint client is http, while service is expecting https负载均衡器 SSL 端点客户端上的 BasicHttpBinding 是 http,而服务需要 https
【发布时间】:2018-06-04 12:22:46
【问题描述】:

所以我有这个无法更改的 wcf 服务,它使用 basicHttpBinding 进行通信。当它在内部使用时,它就像一个魅力。问题是我试图将此服务公开给公众,但该服务位于强制 HTTPS/SSL 的负载均衡器后面。这个 basicHttpBinding 不起作用,并且由于 url 转换和将传输设置为相等传输也不起作用。

目前这是我的客户端绑定:

var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None);

basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
basicHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;

不太确定是否需要最后一部分,无论如何似乎都会抛出相同的错误。

我正在创建的代理服务如下所示:

  <!-- DOWNLOAD HTTP -->
  <service name="ArchiveServiceValidation" behaviorConfiguration="metadataBehavior">
    <endpoint
      address=""
      contract="ArchiveService.IArchiveService"
      name="ArchiveServiceValidationHTTP"
      binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IArchiveService_HTTP"/>

    <endpoint
      address="mex"
      binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IArchiveService_HTTP"
      contract="IMetadataExchange"/>
  </service>

  <!-- DOWNLOAD HTTPS -->
  <service name="ArchiveServiceValidationHTTPS" behaviorConfiguration="metadataBehavior">
    <endpoint
      address=""
      contract="ArchiveService.IArchiveService"
      name="ArchiveServiceValidationHTTPS"
      binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IArchiveService_HTTPS"/>

    <endpoint
      address="mex"
      binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IArchiveService_HTTPS"
      contract="IMetadataExchange"/>
  </service>


 <client>
  <endpoint
    address="http://url-that-has-to-be-http-no-matter-what-i-do.com"
    binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IArchiveService_HTTP"
    contract="ArchiveService.IArchiveService"
    name="DownloadDocumentEndpoint">
    <identity>
      <dns value="localhost" />
    </identity>
  </endpoint>
 </client>

这是我为 HTTP 和 HTTPS 设置的绑定。

  <basicHttpBinding>
    <binding maxBufferPoolSize="5000000" maxReceivedMessageSize="5000000" name="BasicHttpBinding_IArchiveService_HTTPS">
      <security mode="Transport">
        <transport clientCredentialType="None"></transport>
        <message clientCredentialType="Certificate" algorithmSuite="Default"/>
      </security>
      <readerQuotas maxArrayLength="5000000" />
    </binding>
    <binding maxBufferPoolSize="5000000" maxReceivedMessageSize="5000000" name="BasicHttpBinding_IArchiveService_HTTP">
      <readerQuotas maxArrayLength="500000000" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"></transport>
        <message clientCredentialType="Certificate" algorithmSuite="Default"/>
      </security>
    </binding>
  </basicHttpBinding>

还有我的元数据行为配置:

    <behavior name="metadataBehavior">
      <serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true" />
      <useRequestHeadersForMetadataAddress>
        <defaultPorts>
          <add port="80" scheme="http"/>
          <add port="443" scheme="https"/>
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
    </behavior>

【问题讨论】:

    标签: wcf http ssl https binding


    【解决方案1】:
    var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
    

    为我解决了这个问题,原来是 2 放在我使用 BasicHttpBinding 的客户端中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-06
      • 2013-03-13
      • 2022-01-17
      • 2011-12-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多