Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passing parameters best practice

6 views
Skip to first unread message

tshad

unread,
Aug 9, 2006, 2:14:30 PM8/9/06
to
I need to pass a few parameters to my Windows Service program. The end user
will be changing the parameters and settings should be saved.

What is the best practice
- use app.config
- use .ini file
- use Registry
- write a Windows Application program and save the settings to database
table

should I trust the end user to modify registry, .config or .ini file?


no potted meat@hotmail.com David Browne

unread,
Aug 9, 2006, 2:22:37 PM8/9/06
to

"tshad" <tschei...@ftsolutions.com> wrote in message
news:eQuJp%239uGH...@TK2MSFTNGP04.phx.gbl...

app.config, posssibly with a Windows Application to modify the app.config.

David


Anand[MVP]

unread,
Aug 10, 2006, 5:51:01 AM8/10/06
to
Yes app.config is the best place if this is machine specific. If the settings
are shared between multiple machines then a DB may make sense.

Whatever be the option, you will anyway need a app interface for the user to
maintain these parameters.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

Phill W.

unread,
Aug 10, 2006, 12:36:39 PM8/10/06
to
tshad wrote:
> I need to pass a few parameters to my Windows Service program. The end user
> will be changing the parameters and settings should be saved.

Then they'll need a program to help them do it.

> What is the best practice
> - use app.config

Not considered "writeable" in .Net applications (at least as far as
VS'2003).

> - use .ini file
Or an XML configuration file that you can interrogate using XPath.

> - use Registry
Not really recommended anymore - the stupid clogged with too much other
rubbish, it's impossible to back-up reliably and is often protected from
casual (i.e. user) perusal.

> - write a Windows Application program and save the settings to database
> table

[Big!] Yes to having an editing application.
Where the data gets stored depends on lots of things. For example, will
the user be on the same machine as the Service? If not, most file-based
solutions (including the Registry, which is just a file) go straight out
the window.

> should I trust the end user to modify registry, .config or .ini file?

No, definitely not. Indeed, most of them (in commercial organisations)
will be actively prevented from hacking around the Registry.

HTH,
Phill W.

Jay B. Harlow [MVP - Outlook]

unread,
Aug 12, 2006, 5:33:48 PM8/12/06
to
tshad,
What I do is write a Windows Application program that updates the Window's
Services app.config file.

I have the Windows Application restart the service so that it sees the
updated config file.

Currently I am using System.Xml to update the config file, however I'm
thinking the new Configuration namespace in .NET 2.0 (VS 2005) will simplify
changing the config file.

FWIW: The new Configuration namespace in .NET 2.0 definitely simplifies
leveraging the config file!

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


"tshad" <tschei...@ftsolutions.com> wrote in message
news:eQuJp%239uGH...@TK2MSFTNGP04.phx.gbl...

0 new messages