AddressFilter Mismatch
Posted by intrepiddeveloper on November 22, 2008
Recently I came across an interesting issue relating to AddressFiltering in a WCF service. The service was hosted in IIS and exposed two endpoints i.e. Service.svc/endpoint1 and Service.svc/endpoint2. Since both endpoints exposed the same service interface with different bindings, each endpoint address had to be unique, however the opposite is not true i.e. Multiple endpoints with same binding exposing different service interface can use the same address.
The IIS server hosting the service sits behind a Firewall/SSL-off loader/Reverse Proxy network layer. So the client would send messages to https://www.MyServiceHost.com/Service.svc/endpoint1 which would internally get striped-off the SSL and get routed to the IIS server as http://IISHostServer/Service.svc/endpoint1. At this point the servicehost would throw an error message along the lines of “AddressFilter mismatch at the EndpointDispatcher”.
The dispatcher could not resolve which endpoint the messages should be forward to. AddressFilterMode is a service behavior option which controls how the endpoint filters addresses.
The AddressFilter options are:
- Exact: matches to the exact endpoint address.
- Prefix: matches the incoming “TO” address to endpoint address as long as it starts with same prefix address.
- Any: matches all messages to the given endpoint.
The simple fix was to decorate the service behavior with [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
There is a good article on MSDN Magzine that explains Message Addressing here.


