StackTrace
StackTrace

Reputation: 9416

how to refresh/reload app.config file before a function or method executes

I have a windows service that send out emails at a particular hour of the a particular day. The and hour on when the email should be send out along with information like the SMTP server to use are stored in the app.config file.

When i open the app.config file in notepad and change those values, my service does not pick the changes even when i call ConfigurationManager.RefreshSection("configuration");

How can i make sure that every time my email sending function executes, it must first query the app.config for the latest changes/values. Must i restart the service first?

Upvotes: 0

Views: 1371

Answers (1)

LakshmiNarayanan
LakshmiNarayanan

Reputation: 1188

Instead of modifying the app.config, try modifying the appname.exe.config file with this refresh section.

Refer this. Hope it helps. Thanks

Upvotes: 1

Related Questions