Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 749759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:28:19+00:00 2026-05-14T14:28:19+00:00

Quick Question Is it possible to have more than 1 config file in a

  • 0

Quick Question

Is it possible to have more than 1 config file in a windows service?
Or is there some way I can merge them at run time?

Scenario

Currently I have two config files containing the below contents.
After I build and install my Windows Service, I can’t get my custom XML Parser class to read the content because it keeps pointing to the wrong config file, even though I am using a few lines of code to ensure it gets the right name of the config file I need to access.

ALSO

When I navigate to the folder in which the service is installed, there is only sign of the normal APP.Config file, and no sign of the custom config file. (I have even set the normal ones properties to “Do Not Copy” and the custom ones properties to “Copy Always”).

Config File Determination Code

           string settingsFile = String.Format("{0}.exe.config",
                System.AppDomain.CurrentDomain.BaseDirectory
            + Assembly.GetExecutingAssembly().GetName().Name);

CUSTOM CONFIG File

     <?xml version="1.0" encoding="utf-8" ?>
      <configuration>
   <servers>
    <SV066930>
  <add name="Name" value = "SV066930" />
  <processes>
    <SimonTest1>
      <add name="ProcessName" value="notepad.exe" />
      <add name="CommandLine" value="C:\\WINDOWS\\system32\\notepad.exe    C:\\WINDOWS\\Profiles\\TA2TOF1\\Desktop\\SimonTest1.txt" />
              </SimonTest1>
     </processes>
    </SV066930>
   </servers>
  </configuration>

NORMAL APP.CONFIG File

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
   <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx" />
 </configSections>
 <connectionStrings>
    <add name="DB" connectionString="Data Source=etc......" />
  </connectionStrings>
 </configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:28:20+00:00Added an answer on May 14, 2026 at 2:28 pm

    here is a primer on using multiple config files in .net. You can define some settings in a separate file and refer to it in the main config file.

    In your case I think you can do it as this in main config file:

     <Servers file="CUSTOM_CONFIG_FILE.config" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick question that I need some help with if possible. Am
Have a quick question. I am using a SQLite database file in my C#
Quick question. What do you think, I have a few sites that use a
Quick question. There is a legacy website (that is not under my control and
Quick question regarding CSS and the browser. I tried searching SO and found some
Quick question, I was curious if there is any difference between a database table
Quick question, If I want to document some code on a basic HTML and
Quick question about SP 2010 licensing. Is it totally free? Can I install onto
hey, quick question, i couldn't find anything on the web. I have a parent
I have access to some images that can be gathered like this: http://www.example.com/imageGetter.php?a=0001 If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.