title: WCF callback (client not on DNS) There was no endpoint listening at
body: <p>I was doing implementation of in-app chat, so I found very useful article made by 
  By Ger Hayden (A Beginner's Guide to Duplex WCF).
  Following article, my chat started to work very quickly (server and client on same PC)
  Everything went fine until I deployed chat server on test machine.
  When enabling WCF system.diagnostics on server side I found that:</p>
  
  <ul>
  <li>Client is establishing connection with server </li>
  <li>Server is trying to execute callback but fails with exception: </li>
  <li>There was no endpoint
  listening at
  <a href="http://a2200492.m022/Temporary_Listen_Addresses/00bc713c-e37c-4f98-adb6-4dff5b523126/25fb8f22-53dd-408e-8189-e1d3850344e6" rel="nofollow noreferrer">http://a2200492.m022/Temporary_Listen_Addresses/00bc713c-e37c-4f98-adb6-4dff5b523126/25fb8f22-53dd-408e-8189-e1d3850344e6</a>
  that could accept the message. This is often caused by an incorrect
  address or SOAP action. See InnerException, if present, for more
  details. </li>
  <li>The remote name could not be resolved: 'a2200492.m022'</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/o8a1A.png" alt="Remote name could not be resolved"></p>
  
  <p>Problem is that my PC (client) aka a2200492.m022 is not in DNS, so server cannot make resolution Computer Name -> IP.
  I was looking for solution to configure WCF to use IP rather than computer name, but I did not found such configuration parameter. <strong>(If there is one please let me know)</strong>
  Next I found from people having similar problems, idea to add PC to DNS, or add to server hosts file. But I wanted general solution.
  So, solution (or better workaround) that worked is (from code behind put current client IP):
  Client code:</p>
  
  <pre><code> //In method for connecting...
  
  System.ServiceModel.Channels.Binding b = new WSDualHttpBinding("WSDualHttpBinding_Server");
  string clientID = Guid.NewGuid().ToString().Replace("-", ""); //if 2 app on same IP
  /////////////////////////////////////////
  //here is line that solved my problem, let server make callback to my ip
  (b as WSDualHttpBinding).ClientBaseAddress = new Uri(@"http://" + MyIp() + "/" + clientID);**
  /////////////////////////////////////////
  (b as WSDualHttpBinding).ReliableSession = new ReliableSession(){Ordered=true};
  (b as WSDualHttpBinding).Security = new WSDualHttpSecurity() { Mode = WSDualHttpSecurityMode.None };
  (b as WSDualHttpBinding).HostNameComparisonMode = HostNameComparisonMode.WeakWildcard;
  
  //ServerIP 
  EndpointAddress serverIp = new EndpointAddress(System.Configuration.ConfigurationManager.AppSettings["ChatServer"].ToString());
  
  //Instantiate service reference
  chatServer = new ChatServerRef.ServerClient(new InstanceContext(this), b, serverIp);
  //Next step is call method JoinTheConversation on chatServer
  </code></pre>