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 8046241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:44:17+00:00 2026-06-05T05:44:17+00:00

I’m working with a WCF web service project and using log4net, but can’t get

  • 0

I’m working with a WCF web service project and using log4net, but can’t get it to write to the log unless I use an external log4net config file that’s in some safe directory, like C:\temp, and create the log also in some safe directory like C:\temp.

What I mean by “safe” directory is really any directory that’s not under C:\users, or C:\inetpub\wwwroot. If I try to have the log4net config file or the log itself in the C:\inetpub\wwwroot\<projectName> folder where my service is deployed, it just does nothing (no errors, just no log is created and nothing happens). But if I load config from a log4net config file under C:\temp, and write my log to C:\temp, it works fine.

I don’t want to use C:\temp though, I want the log to be in inetpub where the service is deployed, right there with the web.config. I know this is obviously a user permissions issue, but what can be done about it?

Also, I can’t get it to read any log4net config from the web.config file; that’s why I tried using an external log4j config file in the first place.

I’ve read quite a few posts here, and followed their instructions to set everything up. I just need a push in the right direction on what’s best practice to store log4net config for an IIS hosted WCF webservice, and what I can do to be able to store my log in wwwroot/<myprojectfolder>

One of the posts I read was this one… log4net in WCF hosted by IIS 7.5 no write log file

Here’s what I’ve got thus far…

In a AssemblyInfo.cs file I have the following. I’ve tried both ways of specifying a config file, and of letting it try to use web.config by not specifying a config file.

//[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

In Global.asax that I had to add manually I have the following. If I specify a file in a safe directory like C:\temp when I call Configure() it works…

XmlConfigurator.Configure(); 
var logger = LogManager.GetLogger(typeof(Global)); 
logger.Info("Starting up services"); 

And in my service implementation file, I have this…

private static readonly log4net.ILog logger = log4net.LogManager.GetLogger
                (System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Any ideas?

EDIT

I’m using Windows 7 Pro x86 with VS2008 for my dev box and deploying on the local IIS.

  • 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-05T05:44:18+00:00Added an answer on June 5, 2026 at 5:44 am

    I’m a dummy… I worked on this for way too long, then finally asked a StackOverflow question, and just by asking the question I must have knocked something loose in my brain that made me think to just go muck with permissions.

    I fixed this by giving Write and Modify permissions to my IUSR, NETWORK SERVICE and IIS_IUSRS users for the folder where my service is deployed. And voila it works.

    Not sure that all those users need permissions, but at least one of them did.

    Anyways, problem solved.

    Hope this helps someone else, and props to the SO community anyways on being so awesome.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.