title: Obtaining the server IP address in WCF?
body: <p>How can I obtain the <strong>server address</strong> that was used for a request when it has multiple IP addresses?</p>
  
  <p>E.g.</p>
  
  <ul>
  <li>the server has the addresses 10.0.0.1 and 10.0.0.2.</li>
  <li>when processing the request the server service needs to know if 10.0.0.1 or 10.0.0.2 was used by the client to connect to it.</li>
  </ul>
  
  <p>So far I only found that</p>
  
  <ul>
  <li><p><code>OperationContext.Current.EndpointDispatcher.EndpointAddress</code> and <code>OperationContext.Current.Channel.LocalAddress</code> contain the address from .config (e.g. localhost)</p></li>
  <li><p><code>OperationContext.Current.IncomingMessageProperties.Via</code> contains the Url that the client used to connect to the server (but this might just be a name from the clients hosts file).</p></li>
  </ul>
  
  <p>EDIT: still looking for a solution...</p>