PatrickVerbeeten.com
Search this site Powered by Google
Something completely diferent my Photo album

Tracing and Debugging error in CRM 4.0

If errors in Microsoft CRM occur there can be a user friendly or otherwise limited message presented. To find out what actually is the problem is not difficult you just have to know where to look.

Wether it is an authentication issue or a SoapException 'Server was unable to process request'. This article offers some pointers on where to look for additional details.

Authententication Issues

When connecting to CRM you may get a 401 Unauthorized Exception this can be caused by various factors. Some common problems:

  • The credentials are incorrect. Be sure to include the domain in either the <domain>\<user> or <user>@<domain> format.
  • The organization name is incorrect or missing. 
    In CRM 4.0 the organization must be specified on all request. If you enter a organization name not that this is the unique name and it is case sensitve. You can find this name in the deployment manager, or it is the first part after the host name of the URL when connecting to the CRM web interface.
    For requests to the Webservices (CrmService and MetadataService) the organization name must be included in the CrmAuthenticationTokenValue property on the web service class.

Where to check for details:

  • The windows security event log. This will list any invalid credentials.
  • The IIS log files. This will list authentication issues for non IFD requests. Note that a successfull integrated, basic or digest authentication will typically have two requests with a 401 error followed by a request with 200 success code. If there is a failure the third request will also have a 401.
    A 401 error indicates that either the credentials are incorrect or the organization name is incorrect.
    A 500 error code indicates that there is an internal server error. In this case there is an other issue.

Web client interface errors

When the web client shows an error message this can be due to:

A javascript error on the page. This type of error can cause the web form to become unresponsive to user actions. These errors are indicated by a yellow alert triangle in the left lower corner of your browser window.

A dialog box with the message contact your administrator. You can get additional detail in this dialog box by opening the web.config file of the CRM web site and changing the line <add key="DevErrors" value="Off" /> to <add key="DevErrors" value="On" />. Note that this applies to all users.
You can also enable tracing (see below) most of these errors are also logged in the trace files.

Custom code errors

If you are running custom code against the CRM web services you can will always get a SoapException if there is an error on the server. The message of the SoapException will allways have the message 'Server was unable to process request' regardless of the actual problem. To get the details of this error retrieve the value of the Details property this holds an XmlNode which has the details of the error. The Xml contains an 'code' and 'description' node which you can use to display or find out what the error is.
If the Details don't contain enough information (or the description is 'An unexpected error occurred) you can enable tracing on the server. This will give more information and include a stack trace to show where the error exactly included.

If you get an WebException there is either a problem connecting to the server or an there is an authentication exception (check the statuscode property for details).

Enable tracing

To enable tracing on the server (or client for to trace errors in the Outlook client). Add the following settings to the registry

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM]
"TraceEnabled"=dword:00000001
"TraceCategories"="*:Error"
"TraceCallStack"=dword:00000001
"TraceRefresh"=dword:00000001 

 

The trace files are created in the Trace folder in the CRM installation directory (C:\Program Files\Microsoft Dynamics CRM).

Details on the tracing registry settings http://support.microsoft.com/kb/907490/en-us

The trace log files can be hard to read, but Michael Höhne has a tool that simplyfies that. Get it here.

Friday, November 21, 2008

©2010 Patrick Verbeeten, Disclaimer, Privacy Policy