代码之家  ›  专栏  ›  技术社区  ›  palehorse

WCF未绑定到正确的IP地址

  •  3
  • palehorse  · 技术社区  · 17 年前

    我们在Windows 2003服务器上部署了WCF服务,该服务显示出一些问题。配置正在使用 wsHttpBinding 我们正在指定IP地址。这些服务由Windows服务托管。

    当我们启动服务时,大多数情况下它会获取错误的IP地址。有几次它绑定到了正确的地址,但在处理了一段时间后却删除了绑定并转到了绑定到NIC的另一个地址(有2个)。

    httpcfg )尽管我们尝试过使用不同的端口,但结果是一样的。

    下面是设置基址的配置部分。最终的结果是.4而不是.9

    <services>
        <service name="Service.MyService"
                 behaviorConfiguration="serviceBehavior">
            <host>
                <baseAddresses>
                    <add baseAddress="http://xx.xx.xx.9:80/" />
                </baseAddresses>
            </host>
            <endpoint address="MyService"
                      binding="wsHttpBinding"
                      bindingConfiguration="WSHttpBinding_IMyService"
                      contract="Service.IMyService" />
            <endpoint address="mex"
                      binding="mexHttpBinding"
                      contract="IMetadataExchange" />
        </service>
    </services>
    
    • 有没有一个工具可以帮助我们找到这个绑定到错误地址的地方?
    6 回复  |  直到 11 年前
        1
  •  1
  •   aogan    17 年前

    你的WCF配置在我看来没问题。这可能是网卡绑定顺序的问题。请先确保具有正确地址的NIC。以下是一篇讨论如何设置和查看nic绑定顺序的文章:

    http://theregime.wordpress.com/2008/03/04/how-to-setview-the-nic-bind-order-in-windows/

        2
  •  1
  •   aogan    17 年前

    这个问题似乎与国际空间站有关。以下是关于您从中获取的错误的描述 http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/ddf72ae0-aa1e-48c9-88d1-10bae1e87e4f.mspx?mfr=true

    当HTTP.sys分析IP包含列表并发现列表中的所有条目都无效时,此错误将记录到事件日志中。如果发生这种情况,如表11.15所示,HTTP.sys将侦听所有IP地址。

    你也可以检查下面关于类似问题的线索 http://www.webhostingtalk.com/showthread.php?t=534174

    希望这有帮助。

        3
  •  1
  •   A. M.    17 年前

    我们有同样的问题,这个功能帮助我们解决了我们的问题:

    http://msdn.microsoft.com/en-us/library/system.servicemodel.hostnamecomparisonmode.aspx

    希望能帮上忙。

        4
  •  0
  •   palehorse    17 年前

    Description:
    Unable to bind to the underlying transport for xx.xx.xx.4:80. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine.  The data field contains the error number.
    

    我的配置文件仍然具有xx.xx.xx.9基址设置。

        5
  •  0
  •   palehorse    17 年前

    再来一条消息。如果我们将绑定更改为使用NetTcp而不是WsHttp,它将绑定到端口80上的正确地址。将其改回WsHttp会返回不正确的IP地址。

        6
  •  0
  •   Rebecca    15 年前

    基址被忽略。你需要 set a host header under IIS .

    推荐文章