Passing parameters best practice

T

tshad

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?
 
D

David Browne

tshad said:
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?

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

David
 
G

Guest

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.
 
P

Phill W.

tshad said:
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.
 
J

Jay B. Harlow [MVP - Outlook]

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


|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?
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top