Reputation: 5756
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.
Upvotes: 1
Views: 694
Reputation: 5756
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....
Upvotes: 1