For some scenarios, I want to pass the endpoint address to my Channel Factory. But want to use the app config address in other situations.
My Code:
- if (endPointAddress != null && endPointAddress != string.Empty)
- channelFactory = new ChannelFactory<T>(clientEndpointName, new EndpointAddress(endPointAddress));
- else
- channelFactory = new ChannelFactory<T>(clientEndpointName);
When endpoint address is passed (eg: net.tcp://123.4.56.7:9049/Adapter1)
It gives me an error
Dispatch transaction request failed. ---> System.ServiceModel.Security.MessageSecurityException: Identity check failed for outgoing message. The expected DNS identity of the remote endpoint was '123.4.56.7' but the remote endpoint provided DNS claim XXXXX. If this is a legitimate remote endpoint, you can fix the problem by explicitly specifying DNS identity XXXXX as the Identity property of EndpointAddress when creating channel proxy.
Screenshot of App config:
Any help is appreciated.