The sandbox is too busy to handle the request

SharePoint 2010 and SharePoint Online (Office 365) allow for custom development in the form of Sandbox Solutions. Your code is restricted to a subset of the SharePoint API but allows you do most regular operations inside a Site Collection.


Here’s a scenario that fails every time and everywhere:

  • Create a sandboxed Event Receiver that is registered to ItemUpdating
  • Create a sandboxed Web Part that does an SPListItem.Update() from the SharePoint Object Model
  • Watch how the sandbox errors out with the following message

[SPUserCodeSolutionExecutionFailedException: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.]

  • Now just edit the item from the SharePoint UI and watch how that works wonderfully well

Sandbox Request Architecture

So what’s going on here ?

Sandbox request architecture

In light of this you might conclude that there’s no possible communication between two sandbox code requests (the Web Part and the Event Receiver). As good an explanation as any, so feel free to chime in.

Other things

Here are some other things I stumbled upon while researching this issue:

  • ItemUpdated is not affected and works fine
  • You cannot make your “after” events Synchronous in a Sandbox as they won’t fire
  • (Sandbox) Event Receivers can only be registered declaratively in the Feature XML
  • The certificate checking issue ( has the same error message, but is unrelated to this issue
  • Triggering the update from non-Sandbox code works fine


So how about we conclude with a workaround ?

In some cases you could use the “after” Event Receiver rather than the “before” Event Receiver, but isn’t really a sound solution.

The best option would be to rewrite the Web Part to run its code on the client, either through Client OM (ECMAScript or Silverlight), or the SharePoint Web Services.

Client Application Models in SharePoint 2010


Links to this post


Monday, 20 Feb 2012 12:30 by Tor I.
I get an event listener (defined in the item's Elements.xml) to fire (for ItemAdding), but I get the message when it tries to create a new SPWeb during execution (in effect, the team site associated with the new project entry in the list)... could be much the same causes otherwise, though.

Tuesday, 18 Dec 2012 04:05 by Marlou
You totally saved my day with this post! Thanks! PS: The problem still persisted in sharepoint 2013

CAPTCHA Image Validation