This question seems to be pretty close to what I am looking for - I was able to setup tracing and I am looking at the log entries for my calls to the service.
这个问题似乎与我正在寻找的非常接近 - 我能够设置跟踪,我正在查看我对服务的调用的日志条目。
However I need to see the raw soap request with the data I am sending to the service and I see no way of doing that from the SvcTraceViewer (only log entries are shown but no data sent to the service) - am I just missing configuration?
但是,我需要查看原始soap请求以及我发送给服务的数据,并且我看不到从SvcTraceViewer执行此操作(仅显示日志条目但没有数据发送到服务) - 我只是缺少配置?
Here's what I got in my web.config:
这是我在web.config中得到的:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Verbose"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="App_Data/Logs/WCFTrace.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
Any help appreciated!
任何帮助赞赏!
UPDATE: this is all I see in my trace:
更新:这是我在跟踪中看到的全部内容:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2010-05-10T13:10:46.6713553Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{00000000-0000-0000-1501-0080000000f6}" />
<Execution ProcessName="w3wp" ProcessID="3492" ThreadID="23" />
<Channel />
<Computer>MY_COMPUTER_NAME</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.MessageSent.aspx</TraceIdentifier>
<Description>Sent a message over a channel.</Description>
<AppDomain>MY_DOMAIN</AppDomain>
<Source>System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput/50416815</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord">
<MessageProperties>
<Encoder>text/xml; charset=utf-8</Encoder>
<AllowOutputBatching>False</AllowOutputBatching>
<Via>http://xxx.xx.xxx.xxx:9080/MyWebService/myService</Via>
</MessageProperties>
<MessageHeaders></MessageHeaders>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
3 个解决方案
#1
11
You don't have a specific tab that shows just the SOAP message - but the XML tab does include the whole SOAP message - no??
您没有显示SOAP消息的特定选项卡 - 但XML选项卡确实包含整个SOAP消息 - 没有?
alt text http://i39.tinypic.com/j67rf7.jpg
替代文字http://i39.tinypic.com/j67rf7.jpg
What is missing for you from this snippet of XML here??
你在这个XML片段中缺少什么?
UPDATE: John, you're unfortunately not showing what your <system.serviceModel>/<diagnostics>
section looks like - mine used for this result looks like this:
更新:John,遗憾的是你没有显示你的
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="false"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000"
maxMessagesToLog="500" />
</diagnostics>
Do you have the same settings? Maybe you're missing logEntireMessage
or something else??
你有相同的设置吗?也许你错过了logEntireMessage或其他什么?
#2
11
I recently encountered the same problem as in the update to the original question: the trace was showing that a message had been sent, but the message itself wasn't there. For me, the fix was to add a System.ServiceModel.MessageLogging source. Here's my system.diagnostics config section:
我最近遇到了与原始问题更新中相同的问题:跟踪显示已发送消息,但消息本身不存在。对我来说,修复是添加System.ServiceModel.MessageLogging源。这是我的system.diagnostics配置部分:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logfiles\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
And my system.serviceModel / diagnostics section:
我的system.serviceModel / diagnostics部分:
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="true"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000"
maxMessagesToLog="500" />
</diagnostics>
Once I added the MessageLogging source, the TraceViewer showed "Message Log Trace" traces which contained the actual SOAP messages.
一旦我添加了MessageLogging源,TraceViewer就显示了包含实际SOAP消息的“消息日志跟踪”跟踪。
#3
0
There is an another way to see XML SOAP - custom MessageEncoder. The main difference from IDispatchMessageInspector / IClientMessageInspector is that it works on lower level, so it captures original byte content including any malformed xml.
还有另一种方法可以查看XML SOAP - 自定义MessageEncoder。与IDispatchMessageInspector / IClientMessageInspector的主要区别在于它在较低级别上工作,因此它捕获原始字节内容,包括任何格式错误的xml。
In order to implement tracing using this approach you need to wrap a standard textMessageEncoding with custom message encoder as new binding element and apply that custom binding to endpoint in your config.
为了使用此方法实现跟踪,您需要将标准textMessageEncoding与自定义消息编码器包装为新绑定元素,并将该自定义绑定应用于配置中的端点。
Also you can see as example how I did it in my project - wrapping textMessageEncoding, logging encoder, custom binding element and config.
你也可以看看我在项目中是如何做到的 - 包装textMessageEncoding,记录编码器,自定义绑定元素和配置。
#1
11
You don't have a specific tab that shows just the SOAP message - but the XML tab does include the whole SOAP message - no??
您没有显示SOAP消息的特定选项卡 - 但XML选项卡确实包含整个SOAP消息 - 没有?
alt text http://i39.tinypic.com/j67rf7.jpg
替代文字http://i39.tinypic.com/j67rf7.jpg
What is missing for you from this snippet of XML here??
你在这个XML片段中缺少什么?
UPDATE: John, you're unfortunately not showing what your <system.serviceModel>/<diagnostics>
section looks like - mine used for this result looks like this:
更新:John,遗憾的是你没有显示你的
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="false"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000"
maxMessagesToLog="500" />
</diagnostics>
Do you have the same settings? Maybe you're missing logEntireMessage
or something else??
你有相同的设置吗?也许你错过了logEntireMessage或其他什么?
#2
11
I recently encountered the same problem as in the update to the original question: the trace was showing that a message had been sent, but the message itself wasn't there. For me, the fix was to add a System.ServiceModel.MessageLogging source. Here's my system.diagnostics config section:
我最近遇到了与原始问题更新中相同的问题:跟踪显示已发送消息,但消息本身不存在。对我来说,修复是添加System.ServiceModel.MessageLogging源。这是我的system.diagnostics配置部分:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logfiles\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
And my system.serviceModel / diagnostics section:
我的system.serviceModel / diagnostics部分:
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="true"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000"
maxMessagesToLog="500" />
</diagnostics>
Once I added the MessageLogging source, the TraceViewer showed "Message Log Trace" traces which contained the actual SOAP messages.
一旦我添加了MessageLogging源,TraceViewer就显示了包含实际SOAP消息的“消息日志跟踪”跟踪。
#3
0
There is an another way to see XML SOAP - custom MessageEncoder. The main difference from IDispatchMessageInspector / IClientMessageInspector is that it works on lower level, so it captures original byte content including any malformed xml.
还有另一种方法可以查看XML SOAP - 自定义MessageEncoder。与IDispatchMessageInspector / IClientMessageInspector的主要区别在于它在较低级别上工作,因此它捕获原始字节内容,包括任何格式错误的xml。
In order to implement tracing using this approach you need to wrap a standard textMessageEncoding with custom message encoder as new binding element and apply that custom binding to endpoint in your config.
为了使用此方法实现跟踪,您需要将标准textMessageEncoding与自定义消息编码器包装为新绑定元素,并将该自定义绑定应用于配置中的端点。
Also you can see as example how I did it in my project - wrapping textMessageEncoding, logging encoder, custom binding element and config.
你也可以看看我在项目中是如何做到的 - 包装textMessageEncoding,记录编码器,自定义绑定元素和配置。