473,836 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2506
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.o rgwrote in message
news:MP******** *************** *@msnews.micros oft.com...
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.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
Oct 9 '06 #5
Thanks for the input, came to the same conclusion.
Regards,
John

"Patrick Steele" <pa*****@mvps.o rgwrote in message
news:MP******** *************** *@msnews.micros oft.com...
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*********@Nn OwSlPiAnMk.comw rote in message
news:12******** *****@corp.supe rnews.com...
"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
configuratio n 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
5990
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 are like a root directory for a target program on the user's machine my app uses, which they would be prompted to supply at startup. Normally the registry is used for this but I'd rather not use the registry if possible. Isn't there some kind of...
19
2536
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 settings? What is the standard method of saving user settings for VB.Net apps?
7
16570
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 for doing this, but they are (in my opinion) more complicated than I require. I found a method that uses IsolatedStorageFile and IsolatedStorageFileStream, which works correctly. That is, it stores the settings in XML format to a file located...
10
4285
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. Because of this, I am unable to store these settings in the App.Config file, as this gets updated every time the application does, and there doesn't appear to be a way of preventing this. Most of my application settings are kept in the...
10
3066
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 I try to retrieve a setting using this code: //Method 1 string s = ConfigurationManager.AppSettings;
5
8383
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 the XML file or registry. If it's an XML file, then I need the following: 1. Create XSD schema, and be able to validate XML file with the settings against that schema (How would I store the schema, if it's a class library, for example? Would...
13
7149
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 noticed that the designer creates and app.config that gets copied to the output directory as a .exe.config or .dll.config. In this setup any Application Scope property that is in the .exe.config file can be read in from the file and used. My...
6
2814
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 key like 'libPath'. As far as winform and asp.net share the same common base class for settings, SettingsBase, how to manage this ? For winform the value should be set in app.config and for web site in
5
8616
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 plan is to delivere different report.dlls with the main app. But it is essentially importent, that the reports and the app use the same settings.
18
1453
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 application will reside on our network and more than one user could possibly run it so I don't think the local registry is the answer. Basically I just want to remember the options the last user chose on the form and then use those previously used...
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10527
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9358
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6973
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4441
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.