Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

"configuration system failed to initialize" in windows service

Posted on 2010-09-19
2
1,970 Views
Last Modified: 2012-06-22
Hi,

I created a windows service and installed successfully using setup project. However, it throws an exception when I try to start the service. The exception is "configuration system failed to initialize". My app.config has been attached as below. it seems the service could not get the connection string correctly.

this the code throwing exception:
        protected override void OnStart(string[] args)
        {
            string x = ConfigurationManager.ConnectionStrings["LDConnectionString"].ConnectionString;
         }

any idea?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="LDConnectionString" connectionString="Data Source=.;Initial Catalog=LDIntranet;Persist Security Info=True;User ID=ldIntranetUser;Password=XXXXX" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="EmailFromAddress" value="customer@ld.com.au" />
  </appSettings>
  <log4net>
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
      <file value="c:\trace.log" />
      <appendToFile value="true" />
      <maximumFileSize value="100KB" />
      <maxSizeRollBackups value="2" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%level %thread %logger - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="ALL" />
      <appender-ref ref="RollingFile" />
    </root>
  </log4net>
</configuration>

Open in new window

0
Comment
Question by:viola123
2 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 33713701
0
 
LVL 6

Author Comment

by:viola123
ID: 33713831
i already figured out the problem. it was missing configSection part for log4net, thx
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question