When CRM 2011 is configured for claims-based authentication (CBA), Windows Identity Foundation (WIF) is utilized. When troubleshooting CBA, it may be necessary to gather tracing data from the CRM 2011 server. This article details the steps needed in order to create verbose WIF traces from CRM 2011, and how to view those traces in a tool named SvcTraceViewer.
Steps
*Note: These steps should be performed after hours due to the temporary service outage that will result.
- Download SvcTraceViewer.exe from the .NET SDK
- Create a directory to house the log files. In this example, we will be using C:\logs.
- In Windows Explorer, open "%ProgramFiles%\Microsoft Dynamics CRM\CRMWeb"
- Edit web.config in Notepad
- Find the <system.diagnostics> section
- Scroll within <system.diagnostics> and find <source name="Microsoft.IdentityModel"
- Change switchValue="Error" to switchValue="Verbose"
- *Note: The V on Verbose must be capitalized!
- Copy the following lines of text from here to your clipboard:
- <listeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logs\WIF.svclog" />
</listeners>
- <listeners>
- Remove the following lines from under <source name="Microsoft.IdentityModel" switchValue="Verbose">:
- <listeners>
<add name="ServiceModelRedirect" />
</listeners>
- <listeners>
- Paste the text from your clipboard directly under <source name="Microsoft.IdentityModel" switchValue="Verbose">
- Your diagnostics source and listener for Microsoft.IdentityModel should now look like this:
- <source name="Microsoft.IdentityModel" switchValue="Verbose">
<listeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logs\WIF.svclog" />
</listeners>
</source>
- <source name="Microsoft.IdentityModel" switchValue="Verbose">
- Save and Close web.config
- Reproduce your issue
- Stop IIS (or stop the CRM website and application pool). This is required so the handle to the WIF.svclog file is released and we can gather the trace data.
- Copy the WIF.svclog file to an alternate location for review.
- Start IIS (or start the CRM website and application pool).
- Open SvcTraceViewer.exe
- From the File > Open menu, open WIF.svclog
The data in the log is broken out by Activity ID. Each Activity ID can contain multiple events. Work your way down through each Activity ID and each event contained. In this view, you will be able to walk the flow of CBA conversation for the CRM 2011 application.
Steps to revert these changes
- In Windows Explorer, open "%ProgramFiles%\Microsoft Dynamics CRM\CRMWeb"
- Edit web.config in Notepad
- Find the <system.diagnostics> section
- Scroll winthin <system.diagnostics> and find <source name="Microsoft.IdentityModel"
- Change switchValue="Verbose" to switchValue="Error"
- Copy the default listener from the lines of text below:
- <listeners>
<add name="ServiceModelRedirect" />
</listeners>
- <listeners>
- Remove the following lines from under <source name="Microsoft.IdentityModel" switchValue="Error">:
- <listeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logs\WIF.svclog" />
</listeners>
- <listeners>
- Paste the text from your clipboard directly under <source name="Microsoft.IdentityModel" switchValue="Error">
- Your diagnostics source and listener for Microsoft.IdentityModel should now look like this:
- <source name="Microsoft.IdentityModel" switchValue="Error">
<listeners>
<add name="ServiceModelRedirect" />
</listeners>
</source>
- <source name="Microsoft.IdentityModel" switchValue="Error">
- Save and Close web.config