How to change application scoped settings programmatically

M

Mirek Endys

Hello all,

I have this problem.
I have a windows service and I would like to put there Settings for starting
this service. Because of this service is running under NETWORK_SERVICE
account, what is the best way to use settings? Should I create my own
settings or can I use classic application settings. Is there way to change
this application-scoped settings change programmatically?

Thanks.
 
G

Gary Chang[MSFT]

Hi Mirek,
Should I create my own settings or can I use classic application
settings. Is there way to change this application-scoped settings
change programmatically?

Unlike the user-scoped settings, the framework doesn't provide a method to
change application-scoped settings in the run-time, and the
application-scoped settings are read-only in most cases. So I suggest you
can create your own settings in a plain xml file and put it in the same
directory (or a well-known path) with your service's image, then manipulate
that xml file in your service's application to read and edit those settings.

Thanks for your understanding.

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mirek Endys

Thanks, I thought so,
thanks for confirmation. Now, is my soul a little bit calmed. :)

Mirek :))


"Gary Chang[MSFT]" said:
Hi Mirek,
Should I create my own settings or can I use classic application
settings. Is there way to change this application-scoped settings
change programmatically?

Unlike the user-scoped settings, the framework doesn't provide a method to
change application-scoped settings in the run-time, and the
application-scoped settings are read-only in most cases. So I suggest you
can create your own settings in a plain xml file and put it in the same
directory (or a well-known path) with your service's image, then
manipulate
that xml file in your service's application to read and edit those
settings.

Thanks for your understanding.

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
G

Gary Chang[MSFT]

You are welcome, Mirek.:)

Good Luck!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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