We've run into the Sandbox solution error (Web Part Error: The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.).

So we want to redeploy a Web Part as a Farm solution instead of a Sandbox solution.

Is it safe to just make this change in Visual Studio and rebuild/redeploy? Or should I create/deploy a new Web Part in a Farm Solution and modify the pages that currently have this Web Part. There are a lot of pages that use this Web Part.


1 Answer 1


The markup embedded in a SharePoint page for a sandboxed web part is different than a farm-trust web part. It actually uses a special sandboxed web part placeholder with an assembly reference to the sandbox web part type (take a look at a page in SharePoint Designer).

It is easy to change the VS project and re-deploy as farm-trust, but you are going to write a script to loop through all your sites and find and replace all existing web parts to fix existing instances.

  • 1
    I think you answered the explicit question, but I'm curious if there may be a root cause not addressed. Why does that error show? Is it possible the code code be optimized or corrected to adress the error and still use the sandbox? I haven't done enough with these to know and the asker may not have provided enough detail to know this for sure, but I'm guessing this might be an issue.
    – Tom Resing
    Commented Jul 13, 2011 at 15:01
  • Great point Tom. I believe the exception is being throw before the sandbox solution is even loaded or executed - it is a service issue. My own experience with sandbox web parts is the User Code service on a properly configured server with appropriate resources is reliable. I might suggest changing the load balancing on the user code service from the default affinity to run locally, but this may just be a resources issue. Commented Jul 13, 2011 at 15:12
  • 1
    No, I think I left that out. We had been using this WP for months but started getting this error in both DEV and QA yesterday afternoon (At least we noticed it then). Seems that it's a known issue concerning Trust and there is a registry edit to fix it. We've implemented this in DEV and it seems to have worked. I was looking for other options in case this didn't resolve the issue. Commented Jul 13, 2011 at 15:16
  • Chris, thanks for the answer. You mentioned a script to loop through the sites and change the WP. Can you point me at an example of this? Or a starting point? Commented Jul 13, 2011 at 15:21
  • If the web part is scattered all over, this STSADM command may help: sharepoint.stackexchange.com/questions/12847/…
    – Kit Menke
    Commented Jul 13, 2011 at 16:05

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.