473,569 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: app.config and Windows Service.

Hi!

I created a .settings file and added some values. All values are user set
defined.

When i load my windows service i can read from the .config file. But, i can
set a value and save to the file.

What am i missing? Are there any security issues?

I have tried to add assembly to set full trust, but then i cant install my
windows service.

Regards
Martin
Feb 6 '07 #1
3 8146
Hello Martin Arvidsson, Visual Systems AB,

You can't save data to the .config, it's design approach

Use XML file to store your specific settings

MI created a .settings file and added some values. All values are user
Mset defined.
M>
MWhen i load my windows service i can read from the .config file. But,
Mi can set a value and save to the file.
M>
MWhat am i missing? Are there any security issues?
M>
MI have tried to add assembly to set full trust, but then i cant
Minstall my windows service.
---
WBR, Michael Nemtsev [C# MVP]. Blog: http://spaces.live.com/laflour
team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Feb 6 '07 #2
Well, that is strange.

For i have a windows application where the output file is called MyApp.exe
and the config file is called MyApp.exe.confi g and that file i can read and
write to.

Why cant i write to the MyService.exe.c onfig?

Dont make any sence...

Regards
Martin

"Michael Nemtsev" <ne*****@msn.co mskrev i meddelandet
news:a2******** *************** ****@msnews.mic rosoft.com...
Hello Martin Arvidsson, Visual Systems AB,

You can't save data to the .config, it's design approach

Use XML file to store your specific settings

MI created a .settings file and added some values. All values are user
Mset defined.
MMWhen i load my windows service i can read from the .config file.
But,
Mi can set a value and save to the file.
MMWhat am i missing? Are there any security issues?
MMI have tried to add assembly to set full trust, but then i cant
Minstall my windows service.
---
WBR, Michael Nemtsev [C# MVP]. Blog: http://spaces.live.com/laflour
team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


Feb 6 '07 #3
The only reason I can think of why you "cannot write" to the .config file for
your service is that the credentials it is running under do not have write
permissions (unless there is actually a bug in your code).

But remember, if you write to the app.config file, your service will not
pick up the new settiings until it is restarted. Unless of course, you
"manually" reload it after saving and set them yourself.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Martin Arvidsson, Visual Systems AB" wrote:
Hi!

I created a .settings file and added some values. All values are user set
defined.

When i load my windows service i can read from the .config file. But, i can
set a value and save to the file.

What am i missing? Are there any security issues?

I have tried to add assembly to set full trust, but then i cant install my
windows service.

Regards
Martin
Feb 6 '07 #4

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

Similar topics

1
1864
by: miannone | last post by:
I was hoping someone could help me out. I have created a WindowsService that runs periodically throughout the day using a timer. This windows service looks into a Microsoft SQL database and looks at a few tables and performs a few operations. It uses a app.config file to read in some settings, such as: database connection string, time to...
16
4171
by: DraguVaso | last post by:
Hi, I have a Windows Service running (made in VB.NET), and wanted to be able to change from time to time some parameters by changing them in the App.config. But it seems that the application doesn't use the changed values in the App.config, but continue to use the values that were there during start-up. Is there a way to let the...
2
1816
by: bmcelhany | last post by:
Hi all, I have a solution with 4 projects: a class library, a windows app, a windows service, and an installer project. The class library handles all communication with the database and its classes are used by both the application and the service. I have stored the database connection string in an app.config file located in the class...
2
2484
by: Bill | last post by:
I've created a windows service in C#, but I'm having trouble reading <appSettings> from a app.config file. I can read <appSettings> just fine from a normal C# windows app, so there must be some trick to read this file from a windows service, yes? perhaps the location of the .config file? any help is appreciated... -bill
7
1454
by: Tamir Khason | last post by:
Very strange problem I have windows service, that using information from inside App.config by ConfigurationSettings.AppSettings <- Everything is ok here BUT, once I want to read string such as <add key="ConfigPath" value="%my_home_dir%\config\file.xml" /> or <add key="ConfigPath" value="C:\Program Files\MyApplication\Sinfo\config\file.xml"...
2
2660
by: Vinoth Kumar | last post by:
hi all i wrote a windows service. i am trying to get it to use an app.config file. unfortunately, when the service starts, it assumes that the ConfigurationSettings file is in C:\Windows\System32. this is unacceptable to me. rather, i would like the service to assume that the app.config file is in
4
22518
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual ConfigurationSettings.AppSettings Any tips please cheers -- PeterW
1
1801
by: herbert | last post by:
In VS.2005 a Windows Service can have an app.config file. A class library can also have an app.config file. Now if my Windows Services uses three class libraries, each of it coming with its own app.config file, in which sequence are the app config files read in? eg What happens if there are trace switches of the same name with different...
14
5583
by: Peter | last post by:
..NET 3.5 I have a Windows Service application and it does remoting, but when a client incounters an error the client get the following error message "Server encountered an internal error. For more information, turn off customErrors in the server's .config file." Where do I turn this off
0
2236
by: mailtosmita | last post by:
Hi All, I have made a windows service known as polling service which will be using wse3policyCache.config file.The windows service repeatedly calls a method of an existing webservice and in order to call this method its necessary to define wse cache policy.Well everything is working fine except when I am creating installer for the service it...
0
7697
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...
0
7612
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...
0
7924
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. ...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
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...
0
6283
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...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.