previously I asked on sandbox solutions in 2013 here and part of the solution was

[...] coded sandboxed solutions will continue to work in on-premise SharePoint [...]

Yet, I still could not manage to activate even the simplest (empty project, one feature, one event receiver on that feature, no code...) solution. The error is always: Error occurred in deployment step 'Add Solution': An unknown exception occurred while executing a sandboxed code solution request in the worker process.\r\n|0

On my search I encountered (e.g. here and here) the fact, that this seemingly is supposed to happen on dev-machines (i.e. single-sever-all-in-one-SP-installations).

However, there was one answer that suggested

Set-SPLogLevel -Identity "SharePoint Foundation:Sandboxed Code Service" -TraceSeverity "Verbose"
Restart-Service -Name "SharePoint User Code Host"

And now... This fixed the error for me - and I can't comprehend why this is.

  • Can someone verify the "fix"?
  • Can someone shed some light on why this might be?

Probably the User Code Host service wasn't started in your farm. This service needs to be started for sandboxed solutions to be able to execute (sandboxed solutions are run in this process in isolation, so as soon as your sandboxed suction contains server side code, it needs to be started).

What the script you post does is configuring this process to log to the ULS logs, and then restarts it

| improve this answer | |
  • I think this service is disabled by default, at least in 2013 – Robert Lindgren Sep 14 '14 at 11:40
  • This should then be reproduceable by simple reboot, right? :-) – Nils Sep 14 '14 at 14:13
  • A reboot should not leave the service turned off again, no – Robert Lindgren Sep 14 '14 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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