User1623378095 posted
Hi ,
I am having following config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="IndexPath" value="" />
<add key="APIUrl" value="http://www.google.com" />
<add key="Interval" value="3" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
</configSections>
<log4net>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="E:\log-file.txt" />
<param name="AppendToFile" value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
When I ma trying to access using ConfigurationManager.AppSettings["APIUrl"].ToString() then it is giving me error ,but if I remove the configsection and log4net section then it works perfect. Please provide me the solution to access appsettings key in the presence of log4net and configsection.
Thanks ,
Somnath