Saving application settings in Windows Service

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shujaat
    New Member
    • Jul 2009
    • 1

    Saving application settings in Windows Service

    Hi,

    I'm working on a Windows Service (C#) and have added a few Application scope settings in it. Since application-scoped setting are read-only, I have manually added "set" functions for each of them in the designer-generated code. Now I can assign value to these settings at run-time and call the Save function without any exceptions, but this doesn't actually save them to the disk file. Whenever my service restarts, i find that it is still using the old values. I have even run a global file search to find if there's a hidden version of "MyService.exe. config" somewhere in C:\Documents and Settings\Applic ation Data" etc. but cannot locate any such instance. What's going on here?

    Thanks in advance.
  • fastestindian
    New Member
    • Aug 2009
    • 74

    #2
    My friend,
    When u change the values of these settings at run-time values get stores to the memory but as soon as u r application closes it looses its memory and so does the values.

    u need to use config file for contain those values. Try to save values to the .xml file and read those values again.

    Thanks and best of luck...

    Comment

    • PRR
      Recognized Expert Contributor
      • Dec 2007
      • 750

      #3
      Could you post some code? What account are you running the code (windows service). Have you tried testing your code (business code) in a console program?

      Comment

      Working...