Friday, November 4, 2011

The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request

Today I struggled with this little gem of an error when trying to activate the crmlistcomponent.wsp sandbox solution.  The error that I got was:
After scouring the web and finding various blog posts I came accross this one which held the answer.  In my case the answer lay in option IV choice A:

IV.  A fourth known cause is that SharePoint is trying to check for certificate revocations at crl.microsoft.com. The following are workarounds:
A. There is a registry key that is used by the sandboxed solution infrastructure and sometimes gets the wrong value. To ensure that it is set to the correct value, take these steps on all servers that are running the sandboxed host service :
1.On the server, click Start | Administrative Tools | Services.
2.On the Services dialog, scroll to SharePoint 2010 User Code Host.
3.Note the full user name in the Log On As column. You will need this information later.
4.Open SharePoint Management Shell.
5.Enter the following at the command prompt, including all punctuation.
(Get-SPManagedAccount –Identity “username”).Sid.Value
Replace username with the name you obtained in step 3. E.g., CorpDomain\FarmAdmin
This will return the user’s SID (Security ID), which you will use in a later step.
6.    Open the registry editor and navigate to:
HKEY_USERS\SID you obtained earlier\SOFTWARE\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\SoftwarePublishing
7.     Be sure the State key value is set to 0x00023e00.
8.    Restart the sandboxed host service on all servers on which it is to run. It cannot hurt to do an iisreset as well.

If you find that this solution does not work for you, check out the blog entry on the SharePoint Developer Team Blog for other possible solutions.