?
Solved

"configuration system failed to initialize" in windows service

Posted on 2010-09-19
2
Medium Priority
?
2,125 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
[X]
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
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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