Location of file for WCF service (for sobers123)

Jun 12, 2013 at 3:17 PM
sobers123 wrote: "I have logging for my Wcf service using Essential Diagnostics. If i dont give file path in "initializeData", its getting created inside "C:\Windows\System32\inetsrv". is there a way to create in the application root folder?"
This sounds more like a discussion question than a specific issue (usually bugs).

It sounds like your WCF service is being hosted inside IIS, which current directory is the directory of the IIS executable. There is a token {AppData} that you can use to write logs into the ~/App_Data directory. This is safer than writing into the application root folder, e.g. it is protected from downloads.

This change is documented on the RollingFileTraceListener page (https://essentialdiagnostics.codeplex.com/wikipage?title=RollingFileTraceListener), however it is not listed on the XML page -- although both use the same underlying writer and it should work for both.

Try using initializeData="{AppData}/logfile.txt" (or initializeData="{AppData}/logfile.svclog"), and let us know how you go.