However sometime we need to dynamically change the address from code due to some logic.
The naive approach would be to do something like this:
The reason this is naive is that app.config may contain additional information on the endpoint, namely its identity and headers:
when we create the proxy with a different endpoint in the constructor we override the identity information. This may result in this error:
Create the proxy normally. Then separately assign the new endpoint address keeping the identity and header values: