I have one Windows Polling Service to send an automatic email each 10 minutes. I use Thread.Sleep(new TimeSpan(0, 10, 0)); to sleep the thread for 10 minutes, which is hard coded right now.
To avoid hard coding, I have tried app.config which was not successful. I want to move the hard coding to some .ini files. How can I read .ini file from C# Windows Service.
I try the below code to read from my windows service:
string pollingInterval = (string)new AppSettingsReader().GetValue("PollingInterval", typeof(string));
Gives the below error:
Configuration system failed to initialize