Re: Change app.config settings

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: William Stacey [MVP] (staceywREMOVE_at_mvps.org)
Date: 02/19/05


Date: Fri, 18 Feb 2005 23:57:24 -0500

I would just write a simple class and use XmlSerializer to load and save
config.

-- 
William Stacey, MVP
http://mvp.support.microsoft.com
"Peter Rilling" <peter@nospam.rilling.net> wrote in message
news:##H6k4gFFHA.3928@TK2MSFTNGP15.phx.gbl...
> Everything is possible, but not always easy.  The configuration file is
> handled by .NET and therefore you, directly, cannot force it to reload.
One
> thing you might do is to alter your architecture such that you are able to
> load a new AppDomain instance.  Then you can pass the config file which is
> loaded, of coarse, this will essentially create a copy of your program in
> memory.  This is sort of what ASP.NET does.  When the config has changed,
a
> separate processing space is loaded to handle future requests (I think
this
> is how it works).  You could also do away with the whole .NET
configuration
> system and write your own that can be loaded anytime you want.
>
> Given all this, it just might be easier to restart the service.
>
> "Scanner2001" <jeffsanders125@hotmail.com> wrote in message
> news:#39X1YgFFHA.1264@TK2MSFTNGP12.phx.gbl...
> >     I have a service with settings in the app.config file. I would like
to
> > be able to change these settings without restarting the service.
Something
> > similar to a web.config with web services. Whenever I change a setting,
> for
> > example the folder that data is written to, the change does not seem to
> > register. What I believe is that the app.config is read in at the
startup
> of
> > the exe (windows service), and then never read again. Is there a way to
> > force it to read it again? I would prefer not to create another config
> file
> > if I do not have to.
> >     Also, is there a more specific group to post to? Such as windows
> > services newsgroup?
> >
> > Thanks,
> > J
> >
> >
> >
>
>


Relevant Pages

  • How to change the default character colors...and how to view <2 of 4> etc
    ... I don't seem to have a "config" file. ... "The default name of the configuration file varies on different ... but NETHACKOPTIONS can also be set to the ... Okay, now this is starting to make my head swim. ...
    (rec.games.roguelike.nethack)
  • Re: Change app.config settings
    ... The configuration file is ... Then you can pass the config file which is ... > be able to change these settings without restarting the service. ... > the exe (windows service), ...
    (microsoft.public.dotnet.general)
  • Re: Machine Config
    ... framework has a machine.config for the entire machine? ... There are Two config File ... I understand the the usage of Web config, ... Can any explain me why .net frame work requires two configuration file ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Machine Config
    ... that "machine.config" has machine-wide scope for that framework version. ... There are Two config File ... I understand the the usage of Web config, ... Can any explain me why .net frame work requires two configuration file ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re[2]: trouble compiling the kernel
    ... send your configuration file ... AR> regards, ... AR> abdul rf ... I am calling my edited config file DUMMYNET, ...
    (freebsd-questions)