Comments

Sandboxed solution: Unable to load assembly group - The user assembly group provider threw an exception

While developing a Sandboxed solution in SharePoint 2010 using the Visual Studio 2010 SharePoint developer tools it happened that I wasn’t able to deploy the solution using F5.

If you're looking for a solution regarding a production environment please skip to the end of the text.

The error message wasn’t exact on how to solve the problem:

Error occurred in deployment step 'Add Solution': Unable to load assembly group. The user assembly group provider threw an exception while trying to provide user assemblies for the specified assembly group.

The detailed information about the error is the following:

Unable to load assembly group. The user assembly group provider threw an 
exception while trying to provide user assemblies for the specified assembly group.
- Assembly group id: ", GroupId = "<SOME_ID>""
- Inner Exception: System.UnauthorizedAccessException: Access is denied.
(Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))   
at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(...)   
at Microsoft.SharePoint.SPListCollection.EnsureListsData(...)   
at Microsoft.SharePoint.SPListCollection.Undirty()   
at Microsoft.SharePoint.SPBaseCollection.GetEnumerator()   
at Microsoft.SharePoint.SPWeb.GetCatalog(SPListTemplateType typeCatalog)   
...

While doing a search I found a suggestion to change the account for the ‘SharePoint 2010 User Code Host.

The developer image was set up by a colleague who didn’t use the farm account as the domain account for the  SharePoint 2010 User Code Host service.

Here you can see the service... while trying to debug I realized that the given account on the right side was not the one I expected.

The user code service was running with the wrong account.

So I used the services under administrative tools and changed the domain account to the SharePoint 2010 farm account:

Go to administrative tools and services.

Changing the account solved my problem:

Change the domain account for the sandboxed solution service to the farm account.

At the end I was able to deploy the Sandboxed solution.

Production Environment

Jan suggest the following for this scenario:

"In a production environment you should grant the sandbox service account full control on the web application, which solves the same problem."