title: Loading app.config for .DLL To Get WCF Settings
body: <p>I have a .DLL that makes calls to a WCF service.  The DLL is loaded by a separate program that makes method calls to the DLL and the DLL decides whether or not to use WCF by a flag that is passed in the method signatures.  This works normally when I have the WCF binding information in the application, but I do not want to have to put the WCF binding information in the application.  I have tried the following in my .DLL to get the WCF binding information from the DLL's app.config, but each time I try it, I get the following error:</p>
  
  <blockquote>
    <p>Could not find endpoint element with name 'Service' and contract 'Service.IService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.</p>
  </blockquote>
  
  <p>Here is the code I am using to try and get the WCF binding/settings from the DLL's app.config:</p>
  
  <pre><code>        private static readonly Configuration Config = LoadWCFConfiguration();
  
      public void CreateOpsConnection (AccountingOpConnectionDTO opsConnectionDTOFromCaller, bool UseWCFValue)
      {
          opsConnectionDTO = opsConnectionDTOFromCaller;
          UseWCF = UseWCFValue;
  
          if (UseWCF == true)
          {
  
              ConfigurationChannelFactory&lt;AccountingOpsServiceReference.IAccountingOperationsService&gt; accountingOpsChannelFactory = new ConfigurationChannelFactory&lt;AccountingOpsServiceReference.IAccountingOperationsService&gt;
              ("AccountingOperationsService", Config, null);
              WCFClient = accountingOpsChannelFactory.CreateChannel();
              //WCFClient = new AccountingOpsServiceReference.AccountingOperationsServiceClient();
              WCFClient.CreateConnection(opsConnectionDTO);
  </code></pre>