When generating metadata to describe a service, an address is published for the location at which the service can be reached. This is the address to which a client of the service should address a message.
Ordinarily, the metadata address is obtained by looking at the address at which the service is listening for messages. However, if you have a router that forwards messages from a publicly addressable location to a service at a privately addressable location, then the address that the service is listening at is different than the one that should appear in the metadata. A client should send messages to the router’s publicly addressable location rather than trying to send messages to the service directly.
We created a fix for .Net 3.5 to allow the metadata generation for the service to use the address to which the metadata request was sent instead of the address at which the service is listening. After installing the fix, you can add a new service behavior called UseRequestHeadersForMetadataAddressBehavior to your service configuration. The metadata exchange endpoint looks for an instance of this behavior in the service description when generating metadata. In addition to changing the generated address, the behavior also provides a limited way to further remap the port portion of the address.
This fix is available for download from KB article 971842.