configuration system failed to initialize app.config .NET 3.5
I have a WPF application that uses app.config. I set the app.config file
as described in Read/Write App.Config File with .NET 2.0 so it looks like
this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="BDViewerLog.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="5"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger -
%message%newline"/>
</layout>
</appender>
<startup><supportedRuntime version="v2.0.50727"
sku="Client"/></startup><system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Soap" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
<binding name="Service1Soap1" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:9139/Service.asmx"
binding="basicHttpBinding"
bindingConfiguration="Service1Soap"
contract="ServiceReferenceBDV.Service1Soap"
name="Service1Soap" />
<endpoint address="http://localhost:9139/Service1.asmx"
binding="basicHttpBinding"
bindingConfiguration="Service1Soap1"
contract="ServiceReference1.Service1Soap"
name="Service1Soap1" />
</client>
</system.serviceModel>
<appSettings>
<add key="Path1" value="C:\files\Accounts.txt"/>
<add key="PathMD5" value="C:\files\md5Accounts.txt"/>
<add key ="LogUserActions" value="C:\files\Log.txt"/>
</appSettings>
</configuration>
in c# code: string path = ConfigurationManager.AppSettings["PathAccounts"];
I need to read the paths to files in node but I keep getting the error
Configuration system failed to initialize. I looked for a solution in
similar topics but none applied to my case. I checked the file multiple
times, couldn't find an error. I also tried deleting all filed from
\Debug, \Obj and cleaning and rebuilding the solution but nothing worked.
I don't know what more to do.
No comments:
Post a Comment