I am trying the samples from the Learning WCF book and trying to inspect the HTTP request/response. I can see the HTTP Request headers in MS TraceViewer but strangely not the response headers. (only envelope). If you notice something amiss, could you please let me know?
<configuration>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true"/>
</diagnostics>
<!--other stuff-->
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Off, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add initializeData="x.log" type="System.Diagnostics.XmlWriterTraceListener"
name="sdt">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="D:\temp\messages.xml" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
</configuration>
Request gets logged properly:
<MessageLogTraceRecord>
<HttpRequest xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<SOAPAction>"http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGig"</SOAPAction>
<Connection>Keep-Alive</Connection>
<Content-Length>485</Content-Length>
<Content-Type>text/xml; charset=utf-8</Content-Type>
<Expect>100-continue</Expect>
<Host>localhost:8000</Host>
</WebHeaders>
</HttpRequest>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:8000/GigManagerService</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGig</Action>
</s:Header>
<s:Body>
<SaveGig xmlns="http://www.thatindigogirl.com/samples/2006/06">
<item xmlns:a="wcf_expts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:DateEnd>2009-11-01T05:30:00</a:DateEnd>
<a:DateStart>2009-10-31T22:30:00</a:DateStart>
<a:Description>some desc</a:Description>
<a:Id>0</a:Id>
<a:Place i:nil="true"></a:Place>
<a:Title>some boring event</a:Title>
<a:Url>http://askfdj.com</a:Url>
</item>
</SaveGig>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
and the Response I see in Trace Viewer (why no headers, http response?)
<MessageLogTraceRecord>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGigResponse</Action>
</s:Header>
<s:Body>
<SaveGigResponse xmlns="http://www.thatindigogirl.com/samples/2006/06"></SaveGigResponse>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
Are you doing streaming on the response side? That would explain it - when you use streaming, only headers will be logged (not the streamed data).
Marc
If the message was streamed, you would see "...stream..." in the Body tag of the trace (I wrote a post on that.
Aare there other headers than the SOAP headers for a response to an HttpRequest? I mean what you seem to look for is HttpRequest headers, but the response isn't an HttpRequest. I'm not sure, so I might be very wrong :)
Related
I'm using a 32bit BizTalk 2013r1 host instance to send an insert request to Oracle via the LOB adapter.
I need to trace the message body being sent. I have configured the btsntsvc.exe.config as follows:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="xml">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="xml">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.Runtime.Serialization" switchValue="Verbose">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="xml">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\logs\WCFTrace2.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" traceOutputOptions="LogicalOperationStack">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<client>
<remove contract="IMetadataExchange" name="oracledb" />
<endpoint binding="oracleDBBinding" contract="IMetadataExchange"
name="oracledb" />
</client>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
<endToEndTracing activityTracing="true" messageFlowTracing="true" />
</diagnostics>
</system.serviceModel>
My problem is that although the header of the message is logged the body is simply recorded as "...stream..."
<MessageLogTraceRecord>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">http://Microsoft.LobServices.OracleDB/2007/03/BTS/Table/FOOTFALL/Insert</a:Action>
<a:MessageID>urn:uuid:5925f3c6-7670-4eaf-843f-df18a609a4fd</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body>... stream ...</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
Could any please let me know what I need to do to obtain a log of the message body?
Creating another send port that uses the FILE adapter is quite easy.
Set the filter to catch the same messages that would go to Oracle
Add the same maps
This will then write a file to some location for each request, and contain the same message body content as would be sent to the Oracle adapter.
When reviewing IIS logs I see some HTTP 400 responses. To diagnose the problem, I have enabled SVCTrace via the following configuration....
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\temp\messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="C:\temp\tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
While IIS continues to receive HTTP 400 responses, these do not show in the SVCTrace file. I assume this is because a HTTP 400 means bad request, and therefore a bad request never made to WCF to be included in a trace file. Is this an incorrect assumption?
I am trying to log the request ad response messages in my client while the client is consuming a thirdparty WebService.
Despite of many attempts the log file - MessageLog.svclog never gets created using the following WCF configuration in the app.config file. Please help.
<system.diagnostics>
<sources>
<source
name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing" >
<listeners>
<add name="yourTrace"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\Log\MessageLog.svclog">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="false"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" />
</diagnostics>
</system.serviceModel>
Thank you !
Try this. Notice the SharedListeners node
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\Log\MessageLog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
...
</system.serviceModel>
I had problem with WS Client tracing where App.config and folder permissions were totally ok. The solution in my case was that I renamed it to .exe.config (was built to .dll.config of the WS client dll). So make sure:
That the name in the folder of the config file matches the assembly name
That when you run/debug it, the assembly that config file is for, is really used and not assembly for other location.
If it is built into .dll.config it is maybe ignored cause it should be .exe.config.
-m
I'm trying to diagnose a WCF service that is self-hosted in a relatively simple service host process (Service.exe).
I have Service.exe.config configured thus:
<?xml version="1.0" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="All"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\temp\Service.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging maxMessagesToLog="1"
maxSizeOfMessageToLog="2147483647"
logEntireMessage="true"
logMessagesAtServiceLevel="true"
logMalformedMessages="true"
logMessagesAtTransportLevel="true">
</messageLogging>
</diagnostics>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
When I look at the resulting svclog file, I see many trace events being logged (I expected only the first message to be logged), and none of the messages being traced show a message body (only headers).
I'm sure I must be missing something simple here, but I don't see it.
UPDATE: When I look at the WCF Config Editor, there are two sections under "Diagnostics": MessageLogging and Tracing. When I click the "EnableMessageLogging" link, my config file gets updated:
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="All">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add initializeData="c:\temp\MessageBodyTracing.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="traceListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\users\me\documents\visual studio 2010\projects\messagebodytracing\messagebodytracing\app_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
I guess the source named System.ServiceModel.MessageLogging is the key - I hadn't seen that in any documentation of message tracing...
Try to add:
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true" />
in your diagnostics node, under messageLogging.
Set LogEntireMessage to true under Diagnostics->MessageLogging in the Service configuration Editor
I'm trying to follow this tutorial on configuring server-side SOAP tracing for my WCF service, as well as the MSDN documentation.
When I run a test, I see Activity 00000000 in Microsoft Service Trace Viewer but the messages tab is empty. C:\temp\Web_tracelog.svclog is being written but C:\temp\Web_messages.svclog is not.
I'm probably missing something simple here, but can't put my finger on it.
The Diagnostics tab of Microsoft Service Configuration Editor says everything is on. Relevant portions of web.config follow.
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\temp\Web_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="C:\temp\Web_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>
Can't see what's wrong with that config, but here's the config I use that works without a problem if it's of any use:
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener"
initializeData="c:\MyTracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
traceOutputOptions="Timestamp"/>
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>