1
votes

I'm coding a Windows Service.

I added the dll and namespace as shown below .

using System.Configuration;

//This line cause error but why ?

var settings = System.Configuration.ConfigurationManager.AppSettings;

Error:The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration'

Project Target is v4.0 and I successfully install and start service

Thanks.

1
do you see the ConfigurationManager dll in installed location? also look here seems dup question stackoverflow.com/questions/1274852/…indiPy
thank you I think there is AppSettings missing in my config. I added it now.Davut Gürbüz

1 Answers

1
votes

appSettings is a readonly property so we need to define in App.config I think.

<?xml version="1.0"?>
<configuration>
 <appSettings>

 </appSettings>
 ....
 <system.webServer>
   <modules runAllMan....