gpt4 book ai didi

wcf - BasicHttpBinding over Load Balancer SSL Endpoint 客户端是 http,而服务需要 https

转载 作者:太空宇宙 更新时间:2023-11-03 14:33:16 25 4
gpt4 key购买 nike

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

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

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 设置的绑定(bind)。

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

最佳答案

var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

为我解决了这个问题,结果是 2 放置在我使用 BasicHttpBinding 的客户端

关于wcf - BasicHttpBinding over Load Balancer SSL Endpoint 客户端是 http,而服务需要 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50680530/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com