CRM 2011–Cannot publish customizations after import

Problem:

If you ever run into a situation that you imported your solution successfully and not able to publish it, the reason is because either the size of the solution might be too large or the SQL is not fast enough. 

We ran into this problem earlier this week.  We have a slow SQL server and the size of our solution is big, we can’t publish it and we don’t know what was the reason behind it since CRM didn’t provide any helpful error messages.

Cause:

After hours of troubleshooting, we finally figured out that CRM has a default timeout value of 300 seconds = 5 minutes. If any process takes more than 5 minutes, it’ll stop. 

Solution:

Modify the parameters in two different Web.config files:

File 1:

  1. On the CRM application server, open 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 click Open.

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

  5. In Notepad, locate the following line.

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

    Change to

    <httpRuntime executionTimeout="3600" maxRequestLength="20000"/>

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

File 2:

  1. Browse to the folder in which you opened the Web.config file, expand the MSCRMServices folder.

  2. Open the Web.config file with Notepad.

  3. Locate the following line.

    <httpRuntime maxRequestLength="8192"/>

    Change to:

    <httpRuntime maxRequestLength="20000"/>

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

I hope this will save you hours if you run into a similar situation.