How to use the value of appSettings from App.Config file when creating a Windows Service
c#, windows-services
Solution
To my second question I found a solution:
Add a reference to System.Configuration to your code file.
`using System.Configuration;`
The setting may now be referenced correctly...
`ConfigurationManager.AppSettings["UrlToPing"].ToString();`
Problem
I am trying to create a Windows Server. I have some logic in C# ``` string urlToPing = ConfigurationSettings.AppSettings["UrlToPing"].ToString(); Stream data = client.OpenRead(urlToPing); ``` I need to read Here my App.Config ``` <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="UrlToPing" value="http://mysite.com"/> </appSettings> </configuration> ``` I am new at Windows Services, my questions: - When I publish to folder the Service or if I create a build I cannot see the App.Config file - Visual Studio warning on ConfigurationSettings.AppSettings as obsolete (what should I use instead?)