Address filter mismatch
After setting the URL Rewriter on IIS, I got the following error from WCF services which were set as polling duplex or net.tcp protocols.
The message with To 'http://localhost/WCFService.svc' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree. |
The reason is that by default, WCF ensures that the To of each Message matches the intended address.
It's simple to resolve this. Set the AddressFilterMode as Any!
[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
Here's sample code:
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] public class CalculatorService : ICalculator { public double Add(double n1, double n2) { return n1 + n2; } public double Subtract(double n1, double n2) { return n1 - n2; } public double Multiply(double n1, double n2) { return n1 * n2; } public double Divide(double n1, double n2) { return n1 / n2; } } |
References:
http://msdn.microsoft.com/en-us/library/system.servicemodel.addressfiltermode(v=vs.110).aspx