Q: app.config and Windows Service.

  • Thread starter Martin Arvidsson, Visual Systems AB
  • Start date
M

Martin Arvidsson, Visual Systems AB

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
 
M

Michael Nemtsev

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

M> I created a .settings file and added some values. All values are user
M> set defined.
M>
M> When i load my windows service i can read from the .config file. But,
M> i can set a value and save to the file.
M>
M> What am i missing? Are there any security issues?
M>
M> I have tried to add assembly to set full trust, but then i cant
M> install 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
 
M

Martin Arvidsson, Visual Systems AB

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top