2
Answers

Pass EndpointAddress to ChannelFactory with EndPointConfigName

A P

A P

4y
1.3k
1
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:
  1. if (endPointAddress != null && endPointAddress != string.Empty)  
  2. channelFactory = new ChannelFactory<T>(clientEndpointName, new EndpointAddress(endPointAddress));  
  3. else  
  4. 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.
Answers (2)