How to decode the communication between the CRM 2011 server and the CRM 2011 client

The communication between the CRM 2011 outlook Addin and the CRM 2011 Web services is implemented via WCF (Windows Communication Foundation) that ensures that the payload between Server and Client is encrypted (means only the data, not the SOAP envelope) by default. The encryption is handled by WCF and happens transparently for the Application. The good news: WCF supports tracing out of the box.

If you try to capture the Traffic between CRM Server and CRM Outlook client (as you had been used to it in CRM 4.0) with tools like Fiddler, NetMon or whatever you will only see the request and answer flow between client and server, but you do not see the data. This means that most part of the communication between the CRM Server and the CRM Outlook client can be considered as a “black box”.

Enabling WCF Tracing for the CRM Outlook addin provides us the possibility make the “black box” communication visible. The below steps will illustrate “how to” enable WCF tracing.

1. Find the corresponding .config file. Therefore navigate to the program folder where the CRM client is installed. This is “C:\Program Files (x86)\Microsoft Dynamics CRM\Client\” for the 32 bit or “C:\Program Files\Microsoft Dynamics CRM\Client\” for the 64 bit installation. If you used a custom folder please adopt this to your environment. Within this directory you will find the relevant config file –> CrmClient{GUID}.config.

Edit this file using notepad. Please note that dependent on your security settings it may be necessary to run notepad as administrator to edit this file.

Below you will find a sample CrmClient{GUID}.config file:
C:\Program Files (x86)\Microsoft Dynamics CRM\Client\CrmClient{14B13B7A-CA08-40bd-AC60-8C45367E807C}.config

<configuration>
<system.net>
    <defaultProxy useDefaultCredentials="true" />
</system.net>
</configuration>

Insert the complete below “config snippet” inside the <configuration> </configuration> tag. The best place would be before the closing tag </configuration>.

<system.diagnostics>
    <sources>
      <source name ="System.ServiceModel.MessageLogging"
              switchValue="Verbose, ActivityTracing">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
           traceOutputOptions="LogicalOperationStack"
           initializeData="C:\log\CRMTrace.svclog" />
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <system.serviceModel>
    <diagnostics>
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="false"
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="false"/>
    </diagnostics>
  </system.serviceModel>

Please modify the path to the tracefile (initializeData="C:\log\CRMTrace.svclog" ) to your needs or create the tracefolder “c:\log”.Save the file and close notepad. Once done please make sure that you restart outlook and wait until the CRM Addin is enabled. Within the trace folder (in our sample "c:\log") you will see that the system created the trace file “CRMTrace.svclog” or however you named it.

Please don’t forget to “turn off” tracing again after you have created the log file. In order to “turn off” tracing again you need to remove the “config snippet” from the config file + restart Outlook.

If you would like to read the trace file that was created via the config file modification we recommend the following tool: SvcTraceViewer. This tool is part of the Microsoft Windows SDK for Windows 7 and .NET Framework 4.

Attached you will find the SvcTraceViewer.zip file. This only includes the components that are needed to run the SvcTraceViewer. This viewer is one of the Windows SDK components. So if you would like to have more please feel free to download the Windows SDK components you like.

Run the SvcTraceViewer.exe and open your trace file. Once done it might look like below screenshot:

image

Greetings from the CRM team

SvcTraceViewer.zip