473,379 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Settings file

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?

Regards,
John
Oct 5 '06 #1
6 2465
In article <#B**************@TK2MSFTNGP03.phx.gbl>, no@invalid.com
says...
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.
You should look into Remoting. The windows service can host a remoted
object and the UI can talk to the windows service through remoting for
configuration.

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 5 '06 #2
Patrick,

Remoting is a major pain in the neck and more trouble then its worth.
Normally I use a IP connection to send XML packets back and forth.

I really would prefer to have the service configured before it started
rather then starting it and then configuring it.

Thanks,
John

"Patrick Steele" <pa*****@mvps.orgwrote in message
news:MP************************@msnews.microsoft.c om...
In article <#B**************@TK2MSFTNGP03.phx.gbl>, no@invalid.com
says...
>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.

You should look into Remoting. The windows service can host a remoted
object and the UI can talk to the windows service through remoting for
configuration.

--
Patrick Steele
http://weblogs.asp.net/psteele

Oct 6 '06 #3
In article <#R**************@TK2MSFTNGP02.phx.gbl>, no@invalid.com
says...
I really would prefer to have the service configured before it started
rather then starting it and then configuring it.
Then I would use the registry. Despite what Microsoft says these days,
it's kind of what the registry has been designed for and I think it
would fit with what you're trying to do.

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 9 '06 #4
"John J. Hughes II" <no@invalid.comwrote in message
news:%2****************@TK2MSFTNGP03.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
Oct 9 '06 #5
Thanks for the input, came to the same conclusion.
Regards,
John

"Patrick Steele" <pa*****@mvps.orgwrote in message
news:MP************************@msnews.microsoft.c om...
In article <#R**************@TK2MSFTNGP02.phx.gbl>, no@invalid.com
says...
>I really would prefer to have the service configured before it started
rather then starting it and then configuring it.

Then I would use the registry. Despite what Microsoft says these days,
it's kind of what the registry has been designed for and I think it
would fit with what you're trying to do.

--
Patrick Steele
http://weblogs.asp.net/psteele

Oct 9 '06 #6

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
"John J. Hughes II" <no@invalid.comwrote in message
news:%2****************@TK2MSFTNGP03.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
The problem with the app.config file is its read only, I have decided to
just keep using the registry since it seems the best option for what I am
trying to accomplish.

Regards,
John
Oct 9 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include...
19
by: Noozer | last post by:
I need to keep my application settings in a file that users can copy/backup/etc. Before I start using the old INI file standard, is there any easy way to use XML files to hold application...
7
by: Kirk | last post by:
Hello, I am trying to find a VB.NET method that will allow me to save and read an application's settings in a separate file located on any drive, any folder. I have found a couple of methods...
10
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version....
10
by: Chris Dunaway | last post by:
I have an .exe console project and a class library project as part of a solution. The .exe has an App.config file and I have used the Settings page to add some Application level settings. When...
5
by: Andy | last post by:
I need to write a VB.NET WinForms app. For this purpose I need to keep some settings of the application, like many other Windows applications do. The most obvious solution is to store settings in...
13
by: Dave | last post by:
When using the properties designer to store application wide properties how do you get this to work across a project group containing an EXE and a collection of DLLs. I'm using C#.Net 2005. I...
6
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a...
5
by: Rainer Queck | last post by:
Hello NG, Is it possible to share the settings of an application with a class libreary? In my case I have a application and a set of different reports (home made) put into a class library. The...
18
by: Mel | last post by:
What is the best method to achieve this (I am relatively new to vb.net)? Should I use an ini file or the registry? Is there another option available in vb.net that is the preferred way? This...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.