【问题标题】:How do I access a WCF SOAP service through an LTM proxy via PowerShell?如何通过 PowerShell 通过 LTM 代理访问 WCF SOAP 服务?
【发布时间】:2015-06-23 13:44:17
【问题描述】:

我正在使用 PowerShell 访问 WCF SOAP 服务。这一切都是直接在 WCF 端点主机上进行的。我正在使用:

$request = New-WebServiceProxy -uri ${using:endpoint}"?wsdl" -class "MyService" -namespace "MS"

我有一台位于 F5 本地流量管理器 (LTM) 后面的新服务器。当我尝试同样的事情时,我收到了错误,因为返回的 WSDL 包含到服务器本身的链接,这是不可访问的,而不是到 LTM 端点的链接。

这会导致:

The document was understood, but it could not be processed.
  - The WSDL document contains links that could not be resolved.
  - There was an error downloading 'http://myhost/MyService/MyService.svc?xsd=xsd0'.
  - Unable to connect to the remote server
  - No connection could be made because the target machine actively refused it 192.168.1.1:80
    + CategoryInfo          : InvalidOperation: (http://192.168.1...ervice.svc?wsdl:Uri) [New-WebServiceProxy], Invalid
   OperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.NewWebServiceProxy
    + PSComputerName        : localhost

我需要什么才能让 LTM 主机/IP 出现在 WSDL 中?我缺少服务的 web.config 中的某些设置吗?

【问题讨论】:

  • 我认为这更多是 F5 LTM 和 DNS 设置的问题。您的应用/服务应该有一个 DNS 名称。 web.config 应该引用 DNS 名称,然后 F5 LTM 使用此 DNS 名称进行负载平衡。
  • 好的。我希望我可以在不设置 DNS 条目的情况下(还)做到这一点,因为我需要在运行环境中对其进行测试,然后再将现有的 DNS 别名转移到 VIP。情况似乎并非如此。设置 DNS 并为网站正确绑定似乎已经成功了。

标签: wcf powershell soap wsdl f5


【解决方案1】:

将以下内容添加到您的 web.config 文件中:

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <useRequestHeadersForMetadataAddress />

如果没有上述内容,WCF 将从 IIS 获取要呈现的 url。您还可以将主机标头添加到托管 WCF 的站点/应用程序的绑定中,它将改用它。

【讨论】:

  • 看来这需要为VIP添加一个DNS条目。在绑定的“主机名”部分添加 VIP 地址不起作用。
  • @Colorado.Rob:在 MSDN 上进行了一些挖掘,因为我知道我在几年前的某个时候已经这样做了。您也可以在我的编辑中更改 web.config。
猜你喜欢
  • 1970-01-01
  • 2020-09-06
  • 1970-01-01
  • 2016-01-06
  • 2017-05-10
  • 2010-11-15
  • 1970-01-01
  • 1970-01-01
  • 2012-04-08
相关资源
最近更新 更多