R – ASP.NET/WCF tracing does not work within Sharepoint

loggingsharepointtracewcf

I configured message tracing for my WCF webservice like this:

  <!--TRACING  -->
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="log_messages_verbose.log" />
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>

This works fine on my development machine, it logs all messages and traces to an xml file.
Now when deploying the webservice as (sub) Webapplication inside a Sharepoint Webapplication, the service works fine but the trace file stays empty.

I checked the permission on the file, tried absolute file paths, but it still does not work.

Because the webservice is deployed as sub webapplication, it inherits the web.config settings from sharepoint. Could this be an issue? Does sharepoint somehow disable the normal tracing?

Any suggestions are welcome..

Best Answer

Assuming your web service is deployed to its own directory (so that it does not interfere with SharePoint), have you tried adding a web.config with the above trace config to that directory?

Otherwise as Shiraz suggests try adding the trace code to SharePoint's web.config.

Related Topic