locked
Large customizations import causes time out exceptions RRS feed

  • Question

  • I have written an extension product for MSCRM and are now writing the .NET installer utility. I need to import about 20 entities along with many other tasks.
    To import the entities, I am using the ImportCompressedXmlWithProgressRequest class. Unfortunately, it keeps timing out and I am struggling to work out a solution.
    I found this site which suggests adding some registry items to increase the time out duration, but from what I read in another forum/post was that you need to reset the server before the change will take effect.

    Is there a way to import a large quantity of customizations without the time out exceptions?
    I considered breaking it up, but what happens with the relationships when you import an entity where some of the relationship entities dont exist yet?
    Also, I read in the book 'Programming Microsoft Dynamics CRM 4.0' that one should not install new entities via the service request objects 'ImportXml' although they lacked any reason as to why this comment was made. Does any know if there are any issues associated with this method of 'installing' entities?
    Monday, September 28, 2009 5:49 AM

Answers

  • Can you believe it?! It is so simple. It is so incredibly frustrating when the answer you look for is right in front of you, and probably so obvious that people don't think to say it.
    I've recently learnt that CrmService has a property called 'TimeOut' which is defaulted to a 90 second timeout for asyncronous calls. So this timeout issues i was havving was occuring client side. So setting this property to 5 mins (300 * 1000 ms) gives my request execution a 5 minutes responding time. This seems appropriate, seeing it takes over a minute to merely upload the compressed file to the server.

    This is where I found this wonderful piece of information:
    http://msdn.microsoft.com/en-us/library/bb959432.aspx

    I really hope nobody has to suffer as I did :) [...with the additional pressure of my employer wanting immediate results!]

    Thanks for all your responses! Really appreciate it.
    • Marked as answer by Luke Baulch Sunday, October 18, 2009 11:59 PM
    Friday, October 2, 2009 1:54 AM

All replies

  • Hi, Luke.

    To make changes active you don't need reset the server but you need reset iis (iisreset command).
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, September 28, 2009 7:23 AM
    Moderator
  • I know that you can add (or update) some registry keys to avoid timeout...

    in CRM Registry Folder : 
    OLEDBTimeOut = 86400 (in decimal)
    ExtendedTimeout = 1000000 (in decimal)

    it comes from this support kb article: http://support.microsoft.com/kb/918609
    Monday, September 28, 2009 12:21 PM
    Moderator
  • Yes, I had already seen that article (as linked to in my original post) but when I tried it, my timeouts were still occurring after only 1-2 minutes. I also tried resetting IIS, but I didn't find that it helped either. Unless I did something wrong?
    Monday, September 28, 2009 11:50 PM
  • Did you trace the import using CrmDiagTool?

    I had a similar error because of multiple problems:
    - duplicate attributes in customization file
    - case difference between server customization and customizationfile (eg. new_Test and new_test)

    But to be sure, you should really take a trace during import...
    Tuesday, September 29, 2009 7:08 AM
    Moderator
  • Hi Luke,

    What rollup are you running? There are several performance improvements in RU3 and RU6 that can really make a big difference when importing customizations. This KB addresses one of them that is manually applied in RU3: http://support.microsoft.com/kb/956330/.

    Chris
    Tuesday, September 29, 2009 4:59 PM
  • We are running RU5. From what I've read in the RU articles, it doesn't look like RU6 made not of any performance improvements for importation of customizations.
    I have added the OLEDBTimeout and ExtendedTimeOut registry items with values 600 and 1000000 respectively. Its a bit hard to say, but it seems like it is still erroring out.

    My code is fairly simple:

                const string parameterXml = @"<importexportxml>
                                                 <entities>
                                                   {0}
                                                 </entities>
                                                 <nodes/>
                                                 <securityroles/>
                                                 <settings/>
                                                 <workflows/>
                                               </importexportxml>";
    
                var assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
                var entitySchemaResourceName = string.Format("{0}.Entity_Schema.{1}", assemblyName, _entitySchemaFileName);
    
                var formattedParameterXml = string.Format(parameterXml, string.Join("\n", _entitySchemaEntityNames.OrderBy(item => item).Select(item => string.Format("<entity>{0}</entity>", item)).ToArray()));
                var importRequest = new ImportCompressedXmlWithProgressRequest
                                        {
                                            ParameterXml = formattedParameterXml
                                        };
                using (var str = Assembly.GetExecutingAssembly().GetManifestResourceStream(entitySchemaResourceName))
                {
                    if (str == null)
                    {
                        UpdateInstallerProgress(string.Format("Could not locate embedded resource '{0}'", entitySchemaResourceName), false);
                        return;
                    }
                    importRequest.CompressedCustomizationXml = ConvertStreamToByteArray(str);
                }
                try
                {
                    importRequest.ImportJobId = Guid.NewGuid();
                    var response = (ImportCompressedXmlWithProgressResponse)_crmService.Execute(importRequest);
                }
                catch (Exception e)
                {
                    UpdateInstallerProgress(String.Format("Error importing entity schema: {0}", e.Message), true);
                }
    It seems sometimes i get a 'Server is unable to process request.' and other times i get 'The operation has timed out'.
    Any ideas?
    If someone can even point me in the right direction to debug if there is an underlying issue other than time-outs.
    Friday, October 2, 2009 1:28 AM
  • Can you believe it?! It is so simple. It is so incredibly frustrating when the answer you look for is right in front of you, and probably so obvious that people don't think to say it.
    I've recently learnt that CrmService has a property called 'TimeOut' which is defaulted to a 90 second timeout for asyncronous calls. So this timeout issues i was havving was occuring client side. So setting this property to 5 mins (300 * 1000 ms) gives my request execution a 5 minutes responding time. This seems appropriate, seeing it takes over a minute to merely upload the compressed file to the server.

    This is where I found this wonderful piece of information:
    http://msdn.microsoft.com/en-us/library/bb959432.aspx

    I really hope nobody has to suffer as I did :) [...with the additional pressure of my employer wanting immediate results!]

    Thanks for all your responses! Really appreciate it.
    • Marked as answer by Luke Baulch Sunday, October 18, 2009 11:59 PM
    Friday, October 2, 2009 1:54 AM