简体   繁体   English

具有多个NICS的WCF客户端必须使用特定的IP地址

[英]WCF Client with multiple NICS must use a specific IP Address

I have a WCF client application that is being run on a clustered server. 我有一个正在群集服务器上运行的WCF客户端应用程序。 Which means that I have at least 2 IP addresses, the actual machine address and the cluster address. 这意味着我至少有2个IP地址,即实际的计算机地址和群集地址。

The server side firewall only recognizes the cluster address, yes we could add all the possible addresses to the firewall but that is not what my customer wants. 服务器端防火墙只能识别群集地址,是的,我们可以将所有可能的地址添加到防火墙,但这不是我的客户想要的。

So I need to be able to select the IP Address to use from the client application. 因此,我需要能够从客户端应用程序中选择要使用的IP地址。 I would have thought there would be syntax similar to the TCP bind for use with WCF. 我本以为会有与WCF一起使用的类似于TCP绑定的语法。

The WCF client side configuration is really basic and works just fine until this went on a clustered server. WCF客户端配置实际上是基本的,并且可以正常工作,直到在群集服务器上进行配置为止。

One would think this is not an uncommon configuration and there should be a standard configuration solution, I just can't find it. 有人会认为这不是一个不常见的配置,应该有一个标准的配置解决方案,我只是找不到它。

Any suggestions? 有什么建议么?

<client>
<!--
    Server II
-->
    <endpoint address="https://test.us/JLink/Service.svc"
              binding="wsHttpBinding" 
              bindingConfiguration="WSHttpBinding_Service"
              contract="Svc.IService" 
              name="WSHttpBinding_Service">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
</client>

This is NOT hosted in IIS. 这不是托管在IIS中。

TLDR: It's not .net's responsbility to bind to an IP. TLDR:绑定IP并不是.net的责任。 See the documentation on your chosen web server (IIS most likely). 请参阅所选Web服务器(最有可能是IIS)上的文档。

I suspect you want to setup http://test.us/ correctly with the correct IP bind in IIS. 我怀疑您要使用IIS中的正确IP绑定正确设置http://test.us/ As WCF uses Windows Activation Service to get IIS to redirect the http call to the application. 由于WCF使用Windows Activation Service来获取IIS,以将http调用重定向到应用程序。 This will be even easier if your application is in fact hosted IN IIS, which it looks like it is (given the .svc service address). 如果您的应用程序实际上是托管在IIS中(看上去是.svc服务地址),这将更加容易。

This website will show you how to do this for IIS http://www.visualwin.com/Host-Header/ 该网站将向您展示如何针对IIS执行此操作http://www.visualwin.com/Host-Header/

Just enter the IP address you want to bind to when you get to the part where it asks "Enter the IP address to use for this website". 进入询问“输入要用于该网站的IP地址”的部分时,只需输入要绑定的IP地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM