title: RefreshSection not working as expected
body: <p>I'm trying to update the app.config file for a running application.  The update does work (that is, the file gets updated), but when I re-read the file, it shows the old value.  The answer to <a href="https://stackoverflow.com/questions/11466965/why-my-changes-of-appsettings-in-app-config-is-not-taken-into-account-in-run-tim">this</a> question does imply that the app.config is cached, but that calling RefreshSection should force a re-read.</p>
  
  <p>Here's the app.config (straight from an MS example):</p>
  
  <pre><code>&lt;configuration&gt;      
      &lt;startup&gt; 
          &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /&gt;
      &lt;/startup&gt;
      &lt;system.serviceModel&gt;  
          &lt;bindings&gt;  
              &lt;wsHttpBinding&gt;  
                  &lt;binding name="WSHttpBinding_ICalculator" /&gt;  
              &lt;/wsHttpBinding&gt;  
          &lt;/bindings&gt;  
          &lt;client&gt;  
              &lt;endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService"  
                  binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"  
                  contract="ServiceReference1.ICalculator" name="WSHttpBinding_ICalculator"&gt;  
                  &lt;identity&gt;  
                      &lt;userPrincipalName value="migree@redmond.corp.microsoft.com" /&gt;  
                  &lt;/identity&gt;  
              &lt;/endpoint&gt;  
          &lt;/client&gt;      
      &lt;/system.serviceModel&gt;  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>And here's the code for the console app that I'm using to update it:</p>
  
  <pre><code>static void Main(string[] args)
  {
      Console.WriteLine("Before change");            
      ShowConfig();
  
      Console.WriteLine("Change");
      ChangeConfig();
  
      Console.WriteLine("After change");
      ShowConfig();            
  
      Console.ReadLine();
  }
  
  private static void ChangeConfig()
  {            
  
      Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
      string appConfig = File.ReadAllText(configuration.FilePath);
      appConfig = appConfig.Replace("localhost:8000", "myAddress.this.com:8080");
      File.WriteAllText(configuration.FilePath, appConfig);
      configuration.Save(ConfigurationSaveMode.Modified);
  
      ConfigurationManager.RefreshSection("endpoint");
      ConfigurationManager.RefreshSection("client");
      ConfigurationManager.RefreshSection("system.serviceModel");
      ConfigurationManager.RefreshSection("configuration");
  
  }
  
  private static void ShowConfig()
  {
      ClientSection clientSection =
          ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;
  
      ChannelEndpointElementCollection endpointCollection =
          clientSection.ElementInformation.Properties[string.Empty].Value as ChannelEndpointElementCollection;
  
      foreach (ChannelEndpointElement endpointElement in endpointCollection)
      {
          Console.WriteLine(endpointElement.Address);
      }
  }
  </code></pre>
  
  <p>The file does get updated, because I can see that in a text editor while the program is running... but the console shows the same values read twice.  Most of what I've seen for RefreshSection seems to imply it relates more to appSettings, although I haven't seen anything that states that outright.  Is it possible to cause a refresh on the app.config as I am trying to?</p>