I’m using the following web.config to enable tracing for my WCF service. While the file is created normally on the localhost, there’s no file created on the server where my service is deployed.
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
I have granted write permissions to the specified folder for the ASP.NET account. What am I doing wrong?
That sounds a lot like a permission issue.
You say that you granted write permission to the ASP.NET account but your service probably doesn’t run under this account.
For example in IIS 7 Windows 2008 the default account is called
ApplicationPoolIdentity. Under IIS 6 Windows 2003 this default account is calledNetworkService. But in both cases could of course be modified in the IIS Control Panel.So it is not quite clear what you mean when you say the ASP.NET account and to which account you have granted permissions. Also in addition to granting write permissions you might need to grant modify permission so that the process can create the file if it doesn’t exist. Otherwise you need to manually create it first. If you are unsure under which account runs your web service you could use the SysInternals Process Explorer tool to find that out.
Also IIRC the log might not be immediately flushed to the log file. It’s kept in memory for some time and flushed at some intervals. Restarting the application pool ensures that the contents is flushed to the file immediately.