Sometimes an error similar to the one below will occur when a web part from a sandboxed solution is trying to load on a page. This occurs when the sandboxed code is timing out on Microsoft SharePoint, however we’ve found a solution for this:
By default the Worker Process Timeout is set to 30 seconds, if the sandboxed solution takes longer than this to load in the web part then it will timeout. A way around this is to increase the worker process timeout using a powershell command. One thing to note is that the CPU Execution Time must always be greater than the Worker Process Timeout. The below powershell commands will increase both of these values:
$workerProcess= “60”$cpu = “120”$userCode=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local$ userCode.WorkerProcessExecutionTimeout = $ workerProcess$ userCode.ResourceMeasures[“CPUExecutionTime”].AbsoluteLimit = $cpu$ userCode.Update()
After running the above commands the User Code Host service needs to be restarted.
And there you have it, once your User Code Host has been restarted the sandboxed solution should not timeout anymore. Contact us on 01224 531130 or leave a comment if you have any problems with your sandboxed solution timing out.