Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:36:27+00:00 2026-06-15T23:36:27+00:00

I have a WCF stand-alone service that uses log4net with all its configuration in

  • 0

I have a WCF stand-alone service that uses log4net with all its configuration in my app.config file, and I am encrypting the config file on first run of the service. I currently have this set up to run as a console app but when I start it, straight after the encrypted config file is saved, the service prints out

log4net:ERROR XmlHierarchyConfigurator: Cannot find Property
[EncryptedData] to set object on
[log4net.Repository.Hierarchy.Hierarchy]

which confuses me as there is an EncryptedData section in the log4net section of the newly-encrypted config file.

I’m encrypting the config file sections using:

section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");

my log4net config file section looks like this (before):

<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" restartOnExternalChanges="false" />
  </configSections>

  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>
    <root>
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>

and after:

  <log4net configProtectionProvider="DataProtectionConfigurationProvider">
    <EncryptedData>
      <CipherData>
        <CipherValue>AQAAANCMnd8BFdERjHoAw <etc> </CipherValue>
      </CipherData>
    </EncryptedData>
  </log4net>

Log4net still works with the encrypted configuration (edit: that is in debug; when run in release as a service (but permissions opened up) it fails to log anything)

So, can anyone tell me what this error is and how to fix up my code to stop it being thrown.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:36:27+00:00Added an answer on June 15, 2026 at 11:36 pm

    to answer my own:

    the trick is to not use the entry in AssemblyInfo.cs to load log4net, instead put this code in the main method

    XmlConfigurator.Configure();
    

    This loads log4net config after .NET has done its thing and de-crypted the config file. Using the more usual way of putting this line in assemblyinfo obviously makes log4net try to load and read its config before this happens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WCF service hosted by Windows service. This is my app.config file (server-side)
I have WCF service that uses raw messages (Message class). 1) Service side: [DataContract]
I have WCF service that uses wsHttpBinding and authentication with certificate. I run this
I have WCF service that I can upload files. XElement upload = service.UploadFiles(id, File.ReadAllBytes(filePath));
i have written a stand alone WCF REST service in 4.0 under Studio 2010
I have wcf service that twice a minute check %programdata%/MYAPP folder and send all
I have created a stand-alone wcf JSON service (port 4326). On Windows 7, I
So I have wcf rest service which succesfuly runs from a console app, if
I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that I need to call in a ASP.NET web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.