Visual Studio 2010: Sandbox Deployment Errors

So you created a nice Sandbox SharePoint solution and need to deploy it. You entered the correct Site URL and hit deploy. Unfortunately the output shows  a failed deployment step:

image

Couple of deployment errors Visual Studio might throw at you at this stage:

Error occurred in deployment step ‘Activate Features’: Cannot start service SPUserCodeV4 on computer <name>. Check if the Windows Service is not disabled: “SharePoint 2010 User Code Host”. Better yet, set it to “Automatic” on your development machine.
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. Your development environment should have at least one server running the “Microsoft SharePoint Foundation Sandboxed Code Service “. Check in Central Administration/ Services on Server.
Error occurred in deployment step ‘Add Solution’: Sandboxed code execution request failed. This could have a couple of reasons, but the one I encounter the most is lack of rights. I normally enable “god-mode” on my dev machines (see below).
Error occurred in deployment step ‘Activate Features’: Attempted to perform an unauthorized operation. If you are running in “god-mode” this shouldn’t happen. Just make sure you are Site Collection Administrator.

This list is by no means complete and I will extend it as I encounter other issues, hopefully not too many :).

Running in “God-mode”

Important: Not recommended in production environments. Since you are deploying with Visual Studio, this is obviously not the case.

Update 1: if you are a local admin on your dev box (and most of us are), make sure you test your solutions using lesser priviliged accounts!

To enable easy access on your development machine, make sure the following is true

  • Disable User Account Control (in Windows 2008 R2 this means lowering the setting to “Never notify”).

image

  • Microsoft Visual Studio runs as Administrator (see title bar).

image

  • You are a member of the local Administrators group
  • You are a member of the local WSS_ADMIN_WPG group
  • You are database owner (dbo) of both content databases and the SharePoint_Config database
  • You are Farm Administrator
  • You are Site Collection Administrator

Update 2: this post needs revising, since this can be done with fewer permissions than mentioned here.

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s