c# - Wcf - Get Request and Response with System.Diagnostics -
. hello
i have wcf , have record request , associated response.
today seem request , response, have no id associate.
using following configuration in .config:
<system.diagnostics> <sources> <source name="system.servicemodel.messagelogging"> <listeners> <add name="xml" /> </listeners> </source> </sources> <sharedlisteners> <add name="xml" type="ctx_host.webtracelistener, ctx_host" /> </sharedlisteners> </system.diagnostics> <system.servicemodel> <diagnostics> <messagelogging logentiremessage="true" logmalformedmessages="false" logmessagesatservicelevel="true" logmessagesattransportlevel="true" maxmessagestolog="300000" maxsizeofmessagetolog="200000"/> </diagnostics> </system.servicemodel>
and .cs code :
public class webtracelistener : tracelistener { public override void write(string message) { using (var sw = new streamwriter(@"f:\wcf\log.csv", true)) { sw.writeline(message); } } public override void writeline(string message) { using (var sw = new streamwriter(@"f:\wcf\log.csv", true)) { sw.writeline(message); } } }
can tell me if possible link request , response in way or another?
thanks help
the diagnostics generates "correlation activityid" in messages, it's same , relation requests , responses.
this link has more information , can you:
http://www.codeproject.com/articles/392926/grouping-application-traces-using-activityid
and activityid:
http://www.thejoyofcode.com/propagating_the_activityid_to_a_wcf_service.aspx
Comments
Post a Comment