Pages

Current Data and Time in Sri Lanka

Friday, June 3, 2011

Debugging SharePoint Sandbox Solutions - Process 'SPUCWorkerProcess.exe' is not running?

When you have created for an example SharePoint 2010 Event Receiver as a Sandbox solution using Visual Studio 2010 and when you are going to debug your project, sometimes you might get this error "Process 'SPUCWorkerProcess.exe' is not running."

The reason behind this error is, if you are using SharePoint 2010 on a Domain Controller then by default Sandbox solutions are disabled on it. So if you're running SharePoint 2010 on a DC you will need to add a ACL Access Rule to enable Sandbox Solutions. ACL(Access Control List ) means with respect to a computer file system, a list of permissions attached to an object. So without this Access Rule the Microsoft SharePoint Foundation User Code Service will start but the SPUCWorkerProcess.exe won't. Because by default it is disabled. To enable it, you will need to run the following PowerShell script. Make sure to run PowerShell as Administrator.

$acl = Get-Acl HKLM:\System\CurrentControlSet\Control\ComputerName 
$person = [System.Security.Principal.NTAccount]"Users" 
$access = [System.Security.AccessControl.RegistryRights]::FullControl 
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit" 
$propagation = [System.Security.AccessControl.PropagationFlags]::None 
$type = [System.Security.AccessControl.AccessControlType]::Allow 
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access, $inheritance, $propagation, $type) 
$acl.AddAccessRule($rule) 
Set-Acl HKLM:\System\CurrentControlSet\Control\ComputerName $acl

Happy Coding.

Regards,
Jaliya

4 comments:

  1. Please help me here with F5 in simple Farm dev environment: I have purchased your book on SP2010 long back and never had issues with F5 debugging in VS 2010:

    I have two server farm 1. App server Windows Server 2008 R2 + VS 2010 professional
    + SQL sevrer windows server 2008 SP2

    In Task manager, I only see SPUCHostService.exe and SPUCWorkerProcessProxy.exe at times and never see SPUCWorkerProcess.exe appears in processes.

    1) Activated/Deactivated user solution using sitecollection admin credentials
    2) OOB sandbox code Deployment went successfully
    3) When I run from any client machines and try to add sandbox webpart, I get "Sandboxed code execution request failed."
    4) If I run with F5 Unable to attach. Process 'SPUCWORKERPROCESS.exe' is not running on 'machinename'.

    I have followed all the blogs and applied given workaround and I am not getting any trusted advise on this topic.

    I have created another fresh environment

    Configuration database version: 14.0.4762.1000

    I appreciate any help you would give us.

    02/13/2012 15:02:21.38 SPUCHostService.exe (0x07D0) 0x082C SharePoint Foundation Sandboxed Code Service fe8a Medium - - Unable to activate worker process proxy object within the worker process: ipc://1bbd771b-1d17-4dd0-b1a6-0e0bf4165a33:7000
    02/13/2012 15:02:21.38 SPUCHostService.exe (0x07D0) 0x082C SharePoint Foundation Sandboxed Code Service fe8c Medium - - Error activating the worker process manager instance within the worker process. - Inner Exception: System.InvalidOperationException: Unable to activate worker process proxy object within the worker process: ipc://1bbd771b-1d17-4dd0-b1a6-0e0bf4165a33:7000 at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.CreateWorkerProcessProxies()
    02/13/2012 15:02:21.38 SPUCHostService.exe (0x07D0) 0x082C SharePoint Foundation Sandboxed Code Service ei0t Medium - Process creation/initialization threw an exception. Stopping this process. "ipc://1bbd771b-1d17-4dd0-b1a6-0e0bf4165a33:7000"
    02/13/2012 15:02:21.38 SPUCHostService.exe (0x07D0) 0x082C SharePoint Foundation Sandboxed Code Service fe87 Medium - - Error activating the worker process manager instance within the worker process. - Starting worker process threw - Inner Exception: System.InvalidOperationException: Unable to activate worker process proxy object within the worker process: ipc://1bbd771b-1d17-4dd0-b1a6-0e0bf4165a33:7000 at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.CreateWorkerProcessProxies()

    ReplyDelete
  2. Hello Venky,

    There can be couple of reasons for this. You should be running Visual Studio as administrator and if you want to run from client machines, in your Central Admin->System Settings->Manage user solutions, and select "All sandboxed code runs on the same machine as a request."

    Happy Coding.

    Regards,
    Jaliya

    ReplyDelete
  3. Hey Jeliya,

    I had the same issue and running Visual Studio as administrator fixed it, thanks.
    Spent quite sometime struggling with this issue, finally stumbled upon this gem :-).

    Regards

    Vasan

    ReplyDelete
  4. I love all details that you give in your articles.
    security systems for business ct.

    ReplyDelete