Reputation: 5124
Log4Net doesn't write when iis hosting a WCF Service. it works great when i use the self hosting ( Visual Studio Development Server), but when i run it using the IIS it doesn't write anything.
i read about this prolem and the conclusion is that it must be a permission problem, but i don't know how to solve it.
how can i check that i have a permission to write a log file? where can i change the permission? change AppPool users? Can you give me some simple steps of how to check if i have a permission problem?
i'm an administrator on my computer. i'm trying to create the file in the project folder. The file is a rolling file appender.
thank you.
Upvotes: 3
Views: 5736
Reputation: 5124
The problem was solved when i moved the path of the log from "c:\Log.txt" Hard drive to "c:\log\Log.txt" folder in the hard drive.
Upvotes: -1
Reputation: 4860
From my experience, in IIS 7+ you have to make sure the application pool has permission to write in the particular log directory. For example,
Upvotes: 0
Reputation: 2986
For my IIS hosted WCF services with HTTP endpoints, logging to App_Data has proven to be the easiest solution.
<file value="App_Data\log.txt"/>
Upvotes: 6
Reputation: 31610
I ran into a similar situation with Enterprise Library not writing to a file using the Logging Application block for an ASP.NET application. This was EntLib 4.1, the eventual solution after trying ACL modifications was to assign the App Pool to run as Network Service and the text logging commenced, not saying this is your solution, or the best one, but its worth a try.
Upvotes: 0
Reputation: 4085
You need to make sure the AD user that the application pool is running under has create/read/modify privileges to the directory where you're outputting your log files. By default, as far as I know, your app-pool user can't create/modify files. So it sounds like you're on the right track.
Edit: Here is an article to help you determine who your app-pool is running as, if needed.
Upvotes: 1