title: programmatically create/edit the WCF section in the configuration file
body: <p>How can I programmatically create/edit the WCF section in the configuration file?
  I know how to read. But when you try to change the configuration, get the error: </p>
  
  <pre><code>string pathToProg = @ "C: \ Proj \ WCF_Config \ ConsoleApplication1 \ bin \ Debug \Test.config";
  ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
  configFileMap.ExeConfigFilename = pathToProg;
  
  Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
  ClientSection clientSection = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;           
  
  // Exception: "The configuration is read only."
  clientSection.Endpoints.Add(new ChannelEndpointElement(new EndpointAddress(@"http://1.1.1.1:1/HL7"), "Server.Message"));
  </code></pre>
  
  <p>              
  My ultimate goal - to programmatically create from scratch (and edit), the configuration file with settings WCF. If you know how this is solved, please tell me.
  This is necessary for our maintenance department, because they find it difficult to edit the config file directly (Ip, bindings etc).</p>
  
  <p><strong>UPD.</strong>
  Now specifically removed the entire directory checkbox " read-only " .</p>
  
  <p>Nothing has changed.</p>
  
  <p>You can perform at this code ? It's easy - you just have to in the configuration file section was " system.servismodel " with relevant data.</p>
  
  <p>PS . I think the problem in this :
  ClientSection clientSection = ConfigurationManager.GetSection ("system.serviceModel / client") as ClientSection;
  clientSection.Endpoints.IsReadOnly - returns true .</p>
  
  <p>An opportunity my decision is fundamentally wrong . The collection is not editable in principle.</p>
  
  <p>How to correct? I hope someone already faced with the need to create a programmatically  configuration file.</p>