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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:35:21+00:00 2026-05-11T23:35:21+00:00

Is there a way to write in a app.config file the information about endpoints?

  • 0

Is there a way to write in a app.config file the information about endpoints?
Actually I want to read the <service> tag from one app.config file and want to write it in other app.config file’s <Services> tag.

Please anyone tell me how can I do it?

Actually I have a config file called “WCFService.exe.config” which i want to read in my program , so what i am writing is:

string path = Path.Combine(Application.StartupPath, "WCFService.exe.config");
Configuration config = ConfigurationManager.OpenExeConfiguration(path)  

ServicesSection serviceSection = ConfigurationManager.GetSection("system.serviceModel/services") as ServicesSection;

ServiceElementCollection sereleColl = serviceSection.Services;

but i get nothing in sereleColl.

  • 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-11T23:35:22+00:00Added an answer on May 11, 2026 at 11:35 pm

    Take a look at the ConfigurationManager class

    I don’t remember how to do it though.

    Edit:

    To access it you have to add a reference to System.Configuration.

    Edit 2:

    Changing the appsettings can be done like this:

    Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
    AppSettingsSection appSettings = config.AppSettings;
    KeyValueConfigurationElement setting = appSettings.Settings["MyAppSettingsKey"];
    setting.Value = "newValue";
    config.Save(ConfigurationSaveMode.Modified);
    ConfigurationManager.RefreshSection("appSettings");
    

    You can access the WCF settings by typing:

    ConfigurationSectionGroup sct = config.SectionGroups["system.serviceModel"];
    

    Hope this helps.

    Comment:

    Your code is working fine here. However, I changed

    string path = Path.Combine(Application.StartupPath, "WCFService.exe.config");
    

    to

    string path = Application.ExecutablePath;
    

    This will use the config file of the application currently running. I don’t know why your path doesn’t work. Either it’s that, or there must be an error in your config file?

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

Sidebar

Ask A Question

Stats

  • Questions 268k
  • Answers 268k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Sorry for the mess in the top dialog, proper code… May 13, 2026 at 1:04 pm
  • Editorial Team
    Editorial Team added an answer Oh found the problem, well apparently the problem was a… May 13, 2026 at 1:04 pm
  • Editorial Team
    Editorial Team added an answer From jQuery API The .clone() method, when used in conjunction… May 13, 2026 at 1:04 pm

Related Questions

I have a set of configuration items I need to persist to a human
I am trying to write a app.config / web.config error correcting app which will
I am unit testing a .NET application (.exe) that uses an app.config file to
Is there a way to dynamically change the LoginUrl of FormsAuthentication? What I have

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.