0

I am reading a config file to get the value of the baseAddress that is located as below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>...

<system.serviceModel>
<services>
  <service name="nameX" behaviorConfiguration="behaviorConfigurationX">
    <host>
      <baseAddresses>
        <add baseAddress="http://xxx"/>
      </baseAddresses>
    </host>
  </service>
</services>

...</configuration>

I was able to find the services config section but there was no service section under it. Here is the quick watch:enter image description here

How to get the http://xxx from this config file??

EDIT: Here is I how am loading the config file:

 string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\SoftOne";
            string[] directories = Directory.GetDirectories(folderPath, "*" + DisplayName + "*");

            if (directories.Length > 0)
            {
                string[] configFiles = Directory.GetFiles(directories[0], "*.config");

                if (configFiles.Length > 0)
                {
                    System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(configFiles[0]);
                }
            }
Boomer
  • 1,468
  • 1
  • 15
  • 19

0 Answers0