You might try decorating your service class with:
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
You might try decorating your service class with:
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
I don't know about the solution from Mitch Baker, never tried it. But this involves modifying the generated code. There is another way to get around that.
I assume that you generated client code using svcutil.exe, giving a MEX address that points to the firewall. When you do this, all the configuration needed is added to the App.config (or Web.config). However, the service's address in the configuration will point to the real service address (as in the WSDL file the address of the service sill be the real service's address).
So, what I think will solve this issue:
Generate client code by giving the MEX address (eg: http://:Port-X/service/wcfservice.svc?wsdl). This will generated all the needed configuration.
When invoking the client constructor, give the URI of the firewall as the EnpointAddress, and the configuration name of the generated configuration. This way, the client will send a message as if it was sending it to the service, but to the firewall's address:
client = new ServiceClient(endpointConfigName, new System.ServiceModel.EndpointAddress("http://:Port-X/service/wcfservice.svc"));
Mitch's solution worked well, I will try Philippe's out of curiosity XD.
Many thanks to both!
Cheers
A safer way to handle this is to set the endpoint ListenUri to the service Url, and the endpoint Address to the external endpoint where clients send messages. This way the service "trusts" messages directed only to that address, not just ANY address.