Track all calls (+ their stack) made for the WCF service

I have a WCF service that is currently in Production. Code performance is not where we would like it to be, and we cannot reproduce it in our intermediate environment.

I was wondering if it is possible to register every method call made by the service and the service. Essentially, I need a consistent list of all calls and timestamps (our code is not multithreaded).

Is there any way to achieve this without having to use binaries. Is there a trace level in system.diagnostic node in the web.config file that we could change?

+4
source share
2 answers

Have you configured the trace in the configuration file? This is a good article on this subject.

Here is an example configuration that you can use and modify for your needs:

<system.diagnostics> <trace autoflush="true" /> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="ServiceModel" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\ServiceModel.svclog" /> </listeners> </source> <source name="System.ServiceModel.MessageLogging"> <listeners> <add name="MessageLogging" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\MessageLogging.svclog" /> </listeners> </source> </sources> </system.diagnostics> <system.serviceModel> <diagnostics> <messageLogging logEntireMessage="True" logMalformedMessages="False" logMessagesAtServiceLevel="True" logMessagesAtTransportLevel="False" maxMessagesToLog="10000" maxSizeOfMessageToLog="10000" /> </diagnostics> </system.serviceModel> 

Use the trace trace viewer (SvcTraceViewer.exe) to view the received logs.

+6
source

Mark WCF trace and optionally also WCF logging and use SvcTraceViewer to check the collected data - you can also create your own tracer to trace logs, for example, to the database. WCF also provides performance counters .

+2
source

Source: https://habr.com/ru/post/1384790/


All Articles