view size of data being sent back by a wcf service
Anyone know a good tool to view the size of data being returned by a WCF service? I tried using Redgates profiler but I can't see where you can view the information about the payloads being sent back...
Thanks
Err - adding comments is a pain so I will just edit this question...
Essentially yes - I ended up开发者_开发百科 adding tracing. Here is what I added to my .config file.
<system.diagnostics>
<sources>
<source name="System.ServiceModel" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "{LogFile_BasePath}{LogFile_FileName}.svclog" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="{LogFile_BasePath}{LogFile_FileName}.messages.svclog" />
</listeners>
</source>
</sources>
So - With that said it is really nice, I can see the unencrypted SOAP messages which is sweet but whenever I get one that is like + 22k I get this message
The trace record is not correct and cannot be loaded. This might be caused by one of the following reasons:
1. The source file has been changed, which affected the location of the loading trace.
2. There is no valid ending tag in the trace record.
3. The trace file goes wrong.
Trace record file offset: 3081471 Error trace record:
Hmm... It looks like number two is the problem? I am guessing? I am not sure - I know that everything is working I just want to figure out how I am why I am getting this? Is it something in the way I coded the method? I would fins that hard to believe, I would think it wouldn't work at all, I am stuck on this one.
You can always use Fiddler to view what's coming back from your service (if it's coming back over HTTP). You didn't specify the protocol.
You can also use the WCF Service Trace Viewer Tool.
Use built-in WCF Tracing: http://msdn.microsoft.com/en-us/library/ms733025.aspx.
You can turn on tracing using the following configuration:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
Specify the file to output in place of c:\log\Traces.svclog
. Then you should be able to double-click the log file to open with SvcTraceViewer
and easily see all of the requests and the payload contents and sizes.
精彩评论