"John J. Hughes II" <no@invalid.com wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I am creating a new windows service and will have a windows form for
setting the runtime settings. In the past I have used the registry for
this but since MS seems to think this is a bad thing I was attempting to
use the settings file in .NET but I am running into several problems.
1) It seems two or more application can't easily access the same
configuration files. This is primarily because they are located in the
application user directory. Does anybody know how to move the user.config
file to a more logical location or at least consistent location.
2) Adding to the first problem the user.config file is located in the user
directory whereas the service wants to use another. This means that the
user may not be able to access the directory that the service access if my
understanding of permissions is correct.
Does anyone have suggestion on how to work around this or should I just
still to the registry?
Your question has been around for a couple of days, so I'll offer this even
though I don't directly have an answer.
I could swear that I ran across an application-wide way to maintain
settings. I believe that it uses an "app.config " file, and that the file is
stored in a globally-accessible location.
I don't recall off the top of my head how this is done, and I don't have the
..NET docs handy so can't look it up for you. But I'm pretty sure what you
want can be done, and I don't think it's all that hard either.
Of course, the above only addresses the two issues you mentioned. A third
issue may exists, which is that .NET creates a directory specific to an
executable (assembly? manifest? I get a little lost with these new ways to
package up code :) ), as near as I can tell, and so getting your service to
access the same settings file as the configuration application may still be
an issue. I suspect that's solveable though.
I hope that's at least a little bit helpful. :)
Pete