WCF behind load balancer - how to setup

不打扰是莪最后的温柔 提交于 2019-12-05 01:03:03

问题


We have a couple of web servers using load balancer. Machines are running IIS6 on port 81. Externally, site is accessable using port 80. External name and name of the machine are different.

We're getting

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.

Relevant part of web.config is:

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

We tried adding listenUri, but that didn't solve our problems.

Any ideas?


回答1:


[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]

Putting this attribute on service solves the problem.




回答2:


What is the specific load balancer? Using an F5 BIG-IP we got it working fairly easily, but we were using the same port and (relative) uri on the nlb as individual machines (so we can treat an individual machine the same as the farm if we choose). Obviously each machine has a different name, but this setup also allows you to test individual servers by spoofing the host - for example, by editing your HOSTS file to point [your farm name] to [test server IP].

The biggest pain we had was SSL; using TransportWithMessageCredential security, WCF refuses inbound http connections - so we had to set up the nlb to re-encrypt between the nlb and the server node - but not a biggie.

The only other issue we had was with hosting WCF inside IIS, and WCF not being able to correctly identify the intended site (although IIS was fine) over http (but fine over https). To fix this I wrote a custom factory that simply ignored http completely (only listened on https) - which ties in neatly with the TransportWithMessageCredential requirements anyway, so I wasn't bothered by this.

I wonder if you wouldn't get more joy by hosting on a standard port but as a different site (IP/host-header/etc).



来源:https://stackoverflow.com/questions/261463/wcf-behind-load-balancer-how-to-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!