【问题标题】:WCF behind load balancer - how to setup负载均衡器后面的 WCF - 如何设置
【发布时间】:2010-09-20 15:51:09
【问题描述】:

我们有几个使用负载平衡器的 Web 服务器。机器在端口 81 上运行 IIS6。在外部,可以使用端口 80 访问站点。外部名称和机器名称不同。

我们得到了

System.ServiceModel.EndpointNotFoundException: The message with To '<url>' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.

web.config 的相关部分是:

  <endpoint binding="ws2007HttpBinding" bindingConfiguration="MyServiceBinding"
    contract="MyService.IMyService" listenUriMode="Explicit" />

我们尝试添加 listenUri,但这并没有解决我们的问题。

有什么想法吗?

【问题讨论】:

    标签: .net wcf wcf-binding


    【解决方案1】:
    [ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
    

    把这个属性放在服务上就可以解决问题了。

    【讨论】:

    【解决方案2】:

    具体的负载均衡器是什么?使用 F5 BIG-IP 我们让它工作起来相当容易,但是我们在 nlb 上使用相同的端口和(相对)uri 作为单个机器(因此,如果我们选择,我们可以将单个机器与农场相同)。显然,每台机器都有不同的名称,但此设置还允许您通过欺骗主机来测试单个服务器 - 例如,通过编辑您的 HOSTS 文件以将 [您的场名称] 指向 [测试服务器 IP]。

    我们最大的痛苦是 SSL;使用 TransportWithMessageCredential 安全性,WCF 拒绝入站 http 连接 - 因此我们必须设置 nlb 以在 nlb 和服务器节点之间重新加密 - 但不是大问题。

    我们遇到的唯一其他问题是在 IIS 中托管 WCF,而 WCF 无法通过 http(但通过 https)正确识别预期的站点(尽管 IIS 很好)。为了解决这个问题,我编写了一个自定义工厂,它完全忽略了 http(仅在 https 上收听)——无论如何,它与 TransportWithMessageCredential 要求紧密相关,所以我对此并不感到困扰。

    我想知道您是否会通过在标准端口上托管而不是作为不同的站点(IP/host-header/etc)来获得更多乐趣。

    【讨论】:

      猜你喜欢
      • 2016-04-17
      • 1970-01-01
      • 2018-04-20
      • 2023-01-25
      • 1970-01-01
      • 1970-01-01
      • 2013-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多