A time-out occurs when you import large customization files into Microsoft Dynamics CRM 2011

This article provides a resolution for the issue that a time-out occurs when you try to you import large customization files into Microsoft Dynamics CRM 2011.

Important

This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, see Windows registry information for advanced users.

Applies to:   Microsoft Dynamics CRM 2011
Original KB number:   918609

Symptoms

When you import large customization files into Microsoft Dynamics CRM 2011, a time-out occurs. Additionally, you receive one of the following error messages.

Error message 1

Import timeout error.

Error message 2

Maximum request length exceeded.

Error message 3

The file could not be uploaded or Import failed

Error message 4

This is not a valid customization file. Please use an .XML file that was generated by exporting customizations.

If the DevErrors value is set to On in the Web.config file, you receive the following error message:

Microsoft CRM Platform Error Report:

Error Description: Timeout expired

Error Details: Details on this error have not been provided by the platform.

Error Number: 0x80040E31

Additionally, when you upgrade a large Microsoft CRM database to Microsoft Dynamics CRM 2011, you may receive the following error message:

09:54:25| Error| Install exception.System.Exception: Action Microsoft.Crm.Setup.Server.InstallDatabaseAction failed. --->
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at
Microsoft.Crm.Setup.DatabaseInstaller.DatabaseUtility.ExecuteSql(InstallDatabase database, String sql, Int32 timeout) at Microsoft.Crm.Setup.DatabaseInstaller.SqlScriptAction.Execute() at
Microsoft.Crm.Setup.DatabaseInstaller.DatabaseInstaller.Install(Int32 languageCode, String file, Boolean upgrade) at
Microsoft.Crm.Setup.Server.InstallDatabaseAction.Do(IDictionary parameters) at
Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo) --- End of inner exception stack trace --- at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo) at
Microsoft.Crm.Setup.Common.Installer.Install(IDictionary stateSaver) at
Microsoft.Crm.Setup.Server.DatabaseInstaller.Install(IDictionary stateSaver) at
Microsoft.Crm.Setup.Common.ComposedInstaller.InternalInstall(IDictionary stateSaver) at
Microsoft.Crm.Setup.Common.ComposedInstaller.Install(IDictionary stateSaver) at
Microsoft.Crm.Setup.Server.ServerSetup.Upgrade(IDictionary data) at Microsoft.Crm.Setup.Server.ServerSetup.Run()

Cause

This problem occurs because one of the following conditions is true:

  • The time that is used for importing the customization files or for upgrading Microsoft Business Solutions - CRM exceeds the default OLEDBTimeout value in Microsoft Dynamics CRM for the computer that is running Microsoft SQL Server.

  • The time that is used for importing the customization files or for upgrading Microsoft Dynamics CRM exceeds the ExtendedTimeout value that is used for long-running operations.

    Note

    The ExtendedTimeout registry entry on the Microsoft Dynamics CRM server should not be set to a value that is larger than 2,147,483,647. That is the maximum value that the ExtendedTimout registry entry can use.
    Importing customization files can be a long-running operation.

  • The size of the Customization.xml file is larger than 7.5 megabytes (MB).

    Note

    • The Customization.xml file is created when you export custom entities.
    • By default, Microsoft ASP.NET limits the HTTP request size to 8 MB.

Resolution

To resolve this problem, use one or more of the following methods.

Method 1 - Add the OLEDBTimeout and the ExtendedTimeout registry subkeys to increase the time-out values

Warning

Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

  1. Select Start, select Run, type regedit, and then select OK.

  2. Locate the following registry subkey:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM

  3. Right-click MSCRM, point to New, and then select DWORD Value to create a new DWORD value.

  4. Rename the DWORD value to the value OLEDBTimeout.

    Note

    This value is case sensitive.

  5. Right-click the DWORD value, and then select Modify.

  6. In the Edit DWORD Value dialog box, type 86400 in the Value data box, select Decimal in the Base option, and then select OK.

    Note

    According to the requirement of the computer that is running SQL server and the number of customization files, the value can be larger than 86400. The value of 86400 is equivalent to 24 hours. This should only be done temporarily or as a troubleshooting step. The recommended value of this is between 30 and 300. Leaving this setting too high can result in performance issues.

  7. Right-click MSCRM, point to New, and then select DWORD Value to create a new DWORD value.

  8. Rename the DWORD value to the value ExtendedTimeout.

  9. Right-click the DWORD value, and then select Modify.

  10. In the Edit DWORD Value dialog box, type 1000000 in the Value data box, and then select OK.

    Note

    • In the Value data box, you can type a value that is larger than 1,000,000. However, do not type a value that is larger than 2,147,483,647. This is hexadecimal 0x7FFFFFFF.
    • IMPORTANT: If this key already exists, notice the current value. After you have completed the import or the upgrade for Microsoft Dynamics CRM, set the value of this key back to the original value or delete the key if it did not previously exist. The default OLEDBTimeout value is 30 seconds.

Method 2 - Modify the parameters in two different Web.config files

  1. Select Start, select All Programs, select Administrative Tools, and then select Internet Information Services (IIS) Manager.

  2. Expand the server name, and then expand Web Sites.

  3. Right-click the Microsoft CRM Web site, and then select Open.

  4. Right-click the Web.config file, select Open With, and then select Notepad.

  5. In Notepad, locate the following line.

    <httpRuntime executionTimeout="300" maxRequestLength="8192"/>

  6. Change executionTimeout="3600" and change maxRequestLength="20000".

  7. Save and then close the Web.config file.

  8. In the directory in which you opened the Web.config file, open the MSCRMServices folder.

  9. Right-click the Web.config file, select Open With, and then select Notepad.

  10. In Notepad, locate the following line.

    <httpRuntime maxRequestLength="8192"/>

  11. Change maxRequestLength="20000".

  12. Save and then close the Web.config file.

    Important

    After completing the action that requires the above changes to the web.config file, these parameters should be reset to their default values.

More information

The OLEDBTimeout value

The unit of the OLEDBTimeout value is seconds. By default, the OLEDBTimeout value is 30 seconds. The OLEDBTimeout value controls the SQL time-out value that is used for a single SQL query. The increased OLEDBTimeout value is useful when the SQL server is overloaded. Additionally, the query takes a longer time to process.

The ExtendedTimeout value

The unit of the ExtendedTimeout value is milliseconds. By default, the ExtendedTimeout value is 1000000 milliseconds. The ExtendedTimeout value controls the ASP.NET time-out value that is used for import requests. The time-out value must be larger than the time for finishing the whole import process. The increased ExtendedTimeout value is useful when the import process takes a long time.

Note

When the performance of the SQL server is slow or when there are many customization files to import, the import process takes a long time.