My client application makes WCF calls through an HAProxy server on port 8080 which then forwards the traffic to the application server on port 770 which is the port that the application server is expecting. However, WCF is detecting the mismatch of ports 8080 vs 770 and reports the following error:
The message with To 'net.tcp://172.31.31.219:8080/MyEndpoint' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
How can I support this scenario? Everything works fine if I update the client to send traffic on port 770, but this is a special scenario where I want to support different ports.
CodePudding user response:
I want to support different ports.
Maybe you can configure multiple endpoints on the service and implement communication with each endpoint from the client, you can check out the tutorial.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/multiple-endpoints
The message with To 'net.tcp://172.31.31.219:8080/MyEndpoint' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
You can check this post for the solution to this error.
If the service has only one endpoint, a quick workaround is to use
[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
This will turn off the address filter.
Or include the following in the SOAP header to access the web service:
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:To>http://example.com/service</wsa:To>
</soap:title>