4

I created a simple "Hello World" sandbox webpart in VS.NET 2010. After uploading the .wsp file to SharePoint site, I activated the webpart. But while trying to add it to a page, I was getting this error
"The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request."

Following is my SharePoint dev box(Dell XPS laptop) configuration

  1. Windows Server 2008 R2
  2. The machine is configured to run as a Domain Controller
  3. SQL Server 2008 SP2
  4. SharePoint 2010 Enterprise Edition
  5. The SharePoint services are running under a domain user account.
  6. Firewalls policies set to allow inbound\outbound for all networks. Later I disabled the firewall completely.
  7. Formatted and re-installed machine with a fresh SP2010 installation
  8. My development machine is a standalone one without internet connectivity.

I tried out the following steps which I came to find in some blogs and articles, even after implementing the solutions the problem persists. Here are the steps what I did to sort this out.

  1. Made sure the "SharePoint 2010 User Code host" is started under Windows Service.

  2. In Central Admin, the Sandbox solution is started. (I verified this each time after restart)

  3. Executed the following powershell script, as I was running Sp2010 inside a Domain Controller.

     $acl = Get-Acl HKLM:\System\CurrentControlSet\Control\ComputerName
     $person = [System.Security.Principal.NTAccount]“Users”
     $access = [System.Security.AccessControl.RegistryRights]::FullControl
     $inheritance = [System.Security.AccessControl.InheritanceFlags]“ContainerInherit,ObjectInherit”
     $propagation = [System.Security.AccessControl.PropagationFlags]::None
     $type = [System.Security.AccessControl.AccessControlType]::Allow
     $rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access,$inheritance, $propagation, $type)
     $acl.AddAccessRule($rule)
     Set-Acl HKLM:\System\CurrentControlSet\Control\ComputerName $acl
    
  4. Next I tried out all the solutions mentioned in this link. Like registry, hosts file etc. But while trying out the following solution "generatePublisherEvidence enabled="false"" mentioned in the article the sandbox services itself started to crash. So i reverted those change.

  5. After each try, I restarted my system so as to make sure the new settings are getting applied.

  6. I had disabled the wireless network adapter. so as to avoid any changes of that conflicting with SharePoint.

  7. I am able to add and use Visual webparts at the same time.

I am almost out of options on what to do with this error. Please help me.

4
  • Are there any messages in the ULS about the solution? I understand it is a simple webpart, but can you provide the code you used? Commented Jul 10, 2011 at 20:54
  • @Anita Boerboom: I had uploaded the webpart code and ULS logs to this link. gist.github.com/1076564
    – AbrahamJP
    Commented Jul 11, 2011 at 19:18
  • You tried an awful lot of options. I put your webpart on a page on my dev env and no exceptions. Checked some things, but I have no idea. I'm sorry. Commented Jul 13, 2011 at 11:38
  • @Anita Boerboom: Thank you for your time to look into my showstopper issue. Anyway I will have to find it out myself with some debuggers. If any solution surfaces I will be updating this post.
    – AbrahamJP
    Commented Jul 14, 2011 at 16:33

4 Answers 4

1

Every time I've had that error it's because I have a synchronous event receiver in place. With a sandbox solution you can't call SPListItem.Update() any time it would trigger an synchronous event receiver in the same solution. In some cases the event receivers were hanging around from previous deployments and I've had to remove them manually (or even re-create my site collection).

0

It sounds to me that it is your development environment. The issue with the sandbox is that it will limit the resources allotted to it based on what resources are available on the server. When running SharePoint, if your machine is nearly maxed out on RAM, CPU, etc. it will deny sandbox requests.

2
  • My machine config is 8GB RAM, Corei7 Quad Core. With this configuration I hope it wont be running out of resources any time soon for a sandbaox solution. One thing I noticied in TaskManager after installing SP2010 SP1 was that, the SPWorkerProcess.exe instances are getting created in every minute.
    – AbrahamJP
    Commented Sep 19, 2011 at 5:11
  • That might lead you to the right answer. Your machine should be powerful enough. Seeing the processes start/stop so quickly might be the issue. Do you see anything in your ULS or Event Logs? Commented Sep 19, 2011 at 14:27
0

One more step I can think of is to Check the Web.config file in the 14\Usercode folder.It specifies the CAS policies that apply to sandboxed solutions. Ensure that this web.config entries are correct and not modified by anyone.

Long before, One of my team member enabled a httpmodule in the config and got the same error.

0

It looks like you may have tried some of these things already, but this blog post is the ultimate resource for all the different things that could possibly cause this error and how to fix them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.