INTERNET APPLICATION DEVELOPMENT
MID MARKET ERP DEVELOPMENT
By Derek Du
Weeks ago we had an issue with a WCF web service hosted behind a load balancer that addresses redirection and SSL handling. The error message is:
“The message with To ‘https://Your/WCF/Service.svc ‘ cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver’s EndpointAddresses agree.”
Basically this means that your WCF service hosted behind the load balancer does not recognize the request, because the request’s “TO” address, which is a public facing address pointing to the load balancer, does not match the EndpointAddress of your WCF service, which comes from the IIS base address/host headers on the actual web server (where the load balancer will eventually redirect the request)
This checking mechanism of WCF is called AddressFilter, which is turned on by default. So to fix the issue, add this line of code above each service to turn it off:
1
[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
This is a quick and easy fix, but if you have a large number of services, creating a custom behavior to change the default AddressFilter is more feasible. Check the first link in the references for details on how to do that.
References:
Fix WCF AddressFilter mismatch error, customized IServiceBehavior , WCF service behind Load balancer or Firewall
Address Filter mismatch – WCF addressing
This blog post originally appeared in Derek's blog, Stuff.