Troubleshooting Sandboxed Solutions in SharePoint 2010
Posted
Monday, November 30, 2009 1:08 PM
by
CoreyRoth
I have a talk coming up on Code Access Security at SharePoint Saturday Kansas City next month so I have been investigating sandboxed solutions quite a bit. After all, sandboxed solutions are just another flavor of using CAS with some additional things thrown in. However, after I got my SharePoint server installed and configured, I found that sandboxed solutions were not working. When I configured my solution to use the sandbox and tried to deploy it, I got the following error.
Error occurred in deployment step 'Activate Features': Cannot start service SPUserCodeV4 on computer 'servername'.
I found that to be odd, so I decided to do some looking around. I ended up in the Windows Services MMC snapin and found that the service called Windows SharePoint Services UserCode Host v4 was in fact set to disabled. I changed this to automatic and started the service up. I tried to deploy again, but unfortunately things still weren’t working. Here is the error I got this time.
Error occurred in deployment step 'Activate Features': This feature cannot be activated at this time. The contents of the feature's solution requires the Solution Sandbox service to be running.
This one took a little bit more digging, but I ended up going to Central Administration and looking at the Services on Server page. I thought what I needed would be under Service Applications, but that was not the case. I took a look at Services on Server and quickly discovered that the Microsoft SharePoint Foundation User Code Service had not been started. I started the service and then I tried to deploy again and the errors went away and my sandboxed web part worked as expected. I’m not sure why neither of these started. It could be because I don’t have enough memory allocated to the virtual machine or maybe it’s always disabled by default. Anyhow, be sure and check these two things before you try to work in the sandbox.
UPDATE: @MSwannMSFT confirmed for me that this is by design. It’s disabled for performance and security since it spins up three new processes.