Using Trace Viewer for WCF Services

Just wanted to write about a great tool for assisting in debugging issues with a WCF service…and that’s Trace Viewer…some more info about Trace Viewer can found here.

Note: On my machine…running Win7 Ultimate, the exe (SvcTraceViewer.exe) was located in the C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin folder.

We couldn’t determine why a certain request to the service would not complete and Trace Viewer showed us the following:

There was an error while trying to serialize parameter The InnerException message was ‘Maximum number of items that can be serialized or deserialized in an object graph is ‘65536’. Change the object graph or increase the MaxItemsInObjectGraph quota. ‘. Please see InnerException for more details.

We increased the MaxItemsInObjectGraph by following the answer from Daniel Bergsten here

…and voila!…we get data back from the service now!

Here’s part of the relevant client config section.

<endpoint address="http://localhost:3379/ServiceViewEvent.svc" behaviorConfiguration="ServiceViewEventBehavior"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IServiceViewEvent"
        contract="ServiceReferenceViewEvent.IServiceViewEvent" name="WSHttpBinding_IServiceViewEvent">
          <dns value="localhost" />
        <behavior name="ServiceViewEventBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>   

Note the

<dataContractSerializer maxItemsInObjectGraph="2147483647"/>

section in both config files

Here’s part of the service config

      <service behaviorConfiguration=""
        <endpoint address="" binding="wsHttpBinding" contract="">
            <dns value="localhost" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />

About w4ik

software the trenches
This entry was posted in ASP.Net, WCF and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s