473,503 Members | 972 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 8144
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.config and that file i can read and
write to.

Why cant i write to the MyService.exe.config?

Dont make any sence...

Regards
Martin

"Michael Nemtsev" <ne*****@msn.comskrev i meddelandet
news:a2***************************@msnews.microsof t.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
1855
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...
16
4166
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...
2
1810
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...
2
2483
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...
7
1452
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...
2
2654
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...
4
22504
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...
1
1795
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...
14
5560
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....
0
2227
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...
0
7203
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,...
0
7089
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...
0
7282
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,...
1
6995
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...
0
4678
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...
0
3168
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...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
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 ...
0
389
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...

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.