driAn
driAn

Reputation: 3335

ASP.NET/WCF tracing does not work within Sharepoint

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..

Upvotes: 1

Views: 1651

Answers (4)

Gaotter
Gaotter

Reputation: 1906

I had the same issue. What worked for me was to use the "SvcConfigEditor.exe" tool on the SharePoint web.config. I probably did something wrong trying to do it without the tool. C:\inetpub\wwwroot\wss\VirtualDirectories\.

Upvotes: 1

alexholl33
alexholl33

Reputation: 1

I had the same problem, then moved the section to the root web.config in C:\inetpub\wwwroot\wss\VirtualDirectories\80.

I had the same issue with log4net not working, and again moved it into the parent web.config file.

Both now work.

Upvotes: 0

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65381

Do you have the possibility of copying this into sharepoint's web.config?

Also check in your event log for error messages.

Edit

Not sure what the default is for enabled, you could try setting it to true

<trace enabled="true" />

Upvotes: 0

Alex Angas
Alex Angas

Reputation: 60027

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.

Upvotes: 1

Related Questions