title: How to read an endpoint value from an app.config and pass it to my proxy class for the client?
body: <p>I have a service host and its app.config is below:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
   &lt;bindings&gt;
    &lt;netTcpBinding&gt;
      &lt;binding name="NetTcpBinding_ISimSession" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="104857600" maxConnections="10" maxReceivedMessageSize="104857600"&gt;          
      &lt;/binding&gt;
  
      &lt;binding name="NetTcpBinding_ISimExportImportSession" closeTimeout="00:10:00" openTimeout="00:10:00"
             receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Streamed"
             hostNameComparisonMode="StrongWildcard"
             maxBufferSize="2147483647"
             maxBufferPoolSize="2147483647"
             maxReceivedMessageSize="2147483647"&gt;         
  
      &lt;/binding&gt;
    &lt;/netTcpBinding&gt;
  &lt;/bindings&gt;
  
  &lt;services&gt;
    &lt;service name="SimCentral.Server.SimSession"&gt;
      &lt;endpoint address="net.tcp://localhost:8732/Design_Time_Addresses/NextGenService/SimSession/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISimSession"
                contract="NextGenServices.Contract.ISimSessionService.ISimSession"&gt;
        &lt;identity&gt;
          &lt;dns value=""/&gt;
        &lt;/identity&gt;
      &lt;/endpoint&gt;
      &lt;endpoint address="net.tcp://localhost:8735/Design_Time_Addresses/NextGenService/SimExportImportSession/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISimExportImportSession"
                contract="NextGenServices.Contract.ISimSessionService.ISimExportImportSession"&gt;
        &lt;identity&gt;
          &lt;dns value=""/&gt;
        &lt;/identity&gt;
      &lt;/endpoint&gt;
      &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/NextGenService/SimSession/"/&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior&gt;
  
        &lt;serviceMetadata httpGetEnabled="false"/&gt;
  
        &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now, in the client side, I want to create an instance for the proxy class and call the methods of my application. However, my proxy class constructor is taking 2 parameters binding and endpoint which is taking from the app config file above.</p>
  
  <pre><code>// constructor for the proxy
  public SimSessionServiceReferenceProxyObject(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
          {
              ....
          }
  </code></pre>
  
  <p>Question is, how am I gonna get the <code>binding</code> and <code>remoteAddress</code> value from the app.config above to pass it to the constructor ? Consider remoteAddress will be the first endpoint of all 3 endpoints in the app.config. Thank you.</p>