Link to home
Start Free TrialLog in
Avatar of Jahelka
JahelkaFlag for United States of America

asked on

Persist settings in file for windows service + windows app

Hello Experts,

I'm developing in VB.net 4.0 Framework...

I have a windows service that needs to pull some configuration settings from a file.  I am creating a sister windows application that will allow the user to edit the configuration settings for the windows service and persist them to this configuration file.  I can't/don't want to use a database, as one of the primary purposes of the service is to notify admins via email if there is a problem connecting to the database it uses, so it needs to just be a simple configuration file.  I am aware that UAC protects certain locations and prevents normal access to those locations (like anything in the Program Files folder).  So the previously obvious place that I would store this configuration file won't work.

What is the standard practice for doing this type of thing?  Is there a special location that windows has set aside for things of this nature?  Will I have issues because there will be an installed windows application that needs to read/write to this configuration file, and also have a service that needs to be able to locate this file and read from it?  Open to ideas or links to places that explain how I should handle this.

Thank you for your time!
ASKER CERTIFIED SOLUTION
Avatar of parnasso
parnasso
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jahelka

ASKER

Hi Parnasso,

I think what you are recommending might be the way to go.  I was thinking I would have to have the the windows app write the configuration file, and the service just read it.  I got this from some reading in my reference books, and they all say that you can't pass a string or anything else to a service through the service control manager, only a set of 128 numeric commands.  I want the windows app front end to allow the user to modify an email notification list, and it appears that I have to use something besides the service control manager to get that data there.

I have never had the need for anything IPC, so I haven't used it at all.  And frankly, I didn't intend for this to be incredibly complicated.  This is a custom app that will be installed on one single server.  I prefer anytime I can to follow "best practices" so that I don't have to rewrite stuff later on.  But perhaps as simple as my case is, I should just make a special folder as part of the install, and write both the app and the service so that they assume the configuration file is in the same place, and leave it at that.  Otherwise I can see myself spending a couple of day's time writing and debugging something that could be solved easily if I just impose some limitations on myself and the application.

If you guys have anything else to add, then please do so.  I'll let this sit for another day or two and see if someone else doesn't have a bright idea for the best way to do this before throwing points out.

Thanks guys!
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.