Using CRM Services to create or update records in large numbers

Recently, I implemented a plug in code which invoked auto creation of records from a contacts list (rather marketing lists based on MS CRM contacts) for my custom entity. The code worked well but it hanged whenever I considered a marketing list of more than 3000 contacts. The error logged read: Only one usage of each socket address (protocol/network address/port) is normally permitted.


Basically, the error was thrown when the creation process exhausted the limit of socket connections allowed by the IIS and the SDK still polled for another connection and consequentially timed out after a certain number of records were created. A quick workaround for this is to change the following entries in the registry:

HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort to 65534AndHKLM\System\CurrentControlSet\Services\Tcpip\Parameters\TCPTimedWaitDelay to be 30




The link : http://dmcrm.blogspot.com/2008/07/updating-records-in-mass-via-sdk.html also mentions a resolution of this by using the following code snippet:



int NUM_RETRY_ITERATIONS = 50;
int p = 0;
do
{
try
{
crmService.Create(customentity);
p = NUM_RETRY_ITERATIONS;
}
catch (Exception e)
{
p++;
if (p >= NUM_RETRY_ITERATIONS)
{
throw (e);
//WriteToFile("updateContact error: " + e.Message + " " + e.InnerException);
}
System.Threading.Thread.Sleep(500);
}
} while (p < NUM_RETRY_ITERATIONS);

Comments

  1. Very nice & useful post.Thx for sharing the information.

    ReplyDelete
  2. Thank you for posting such a useful, impressive and informative content

    CRM Software Development Company In Delhi

    ReplyDelete
  3. 5F9F1Karleigh4D3BAApril 14, 2024 at 6:01 AM

    0FD6B
    ----
    ----
    ----
    ----
    ----
    ----
    ----
    matadorbet
    ----

    ReplyDelete

Post a Comment

Popular posts from this blog

IFD Implementation for custom web pages and Anonymous Access

Issues after Re-Naming MS CRM Servers computer/machine name