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 8894725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:34:44+00:00 2026-06-14T23:34:44+00:00

Right, so I have a Windows service that goes off and does some work

  • 0

Right, so I have a Windows service that goes off and does some work on a server every few minutes. The service reads a whole lot of info (host, username, port etc) regarding the server it’s connecting to from the App.config and it works just great.

I now have a requirement that the service caters for n different servers. So now my service needs to read from the App.config and do what it needs to do for server1..serverN sequentially. Wait a predetermined time and then start at server1 again.

I don’t know how or what would be the best way to store n sets of server settings in the App.config and then programatically determine how many sets of settings there are and then read each set.

I’ve thought of having a setting that tells me that there are 5 servers and then having settings for server1..server5 but that’s really not elegant.

Is there a better way to do this?

My full source file is below:

using System;
using System.Collections;
using System.Text;
using System.Configuration;
using System.Xml;

namespace FTPConfig
{
    public class MyAppConfig : ConfigurationSection
    {
        public static MyAppConfig GetConfiguration()
        {
            MyAppConfig configuration = ConfigurationManager.GetSection("MainSettings") as MyAppConfig;

            if (configuration != null) return configuration;

            return new MyAppConfig();
        }
    }

    [ConfigurationProperty("host", IsRequired = true)]
    public String Host 
    { 
        get 
        { 
            return this["host"] as string; 
        } 
    }
}
  • 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-06-14T23:34:45+00:00Added an answer on June 14, 2026 at 11:34 pm

    You can use a custom section in the app.config file, and use any xml you like there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built one windows service that sends out email after every 30 minutes
I have a windows service that has a lot of work to do simultaneously.
I have a windows Service that start some tasks based on a configuration. Each
I have a panel that is docked to the right side of a windows
I have a C# service that works without any problems on my laptop (Windows 7).
I have a .net windows service that works it's way through a queue of
Background: I have a .NET 4.0 web service running on Windows Server 2008 written
I have created an windows service. I want to open some windows based application
We have built a Windows Service that is running on client's machines, which occasionally
I have a Windows service (under WinXP SP2), running under the LocalSystem account, that

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.