Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm deploying a web part as a component of a sandboxed solution from Visual Studio 2010 to Windows 7 SharePoint Foundation Server 2010 on my development box, and I receive the following error when viewing the web part on the deployed web part page:

Web Part Error: No available sandboxed code execution server could be found.

[SPUserCodeExecutionPipelineFailedException: No available sandboxed code execution server could be found.]
  at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext) 
  at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.<>c__DisplayClassa.b__9() 
  at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) 
  at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.ExecuteRequestInSandBox(HttpContext context, SPWeb web, SPWebPartManager manager, SPUserCodeWebPart userCodeWebPart)

[SocketException: No connection could be made because the target machine actively refused it 192.168.222.1:32846]

 Server stack trace: 
  at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port) 
  at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(AddressFamily family) 
  at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket() 
  at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew) 
  at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream) 
  at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream) 
  at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg) 

 Exception rethrown at [0]: 
  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
  at Microsoft.SharePoint.Administration.ISPUserCodeExecutionHostProxy.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinityBucketName, SPUserCodeExecutionContext executionContext) 
  at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext)

I've heard this can be related to the 'SharePoint 2010 User Code Host' service being stopped, and sure enough it isn't running. However, when I start the service it immediately stops itself, with no warning or error (the Event log only shows the "started successfully" message).

This in turn (I've heard) may be related to the 'SharePoint Foundation Search V4' service being stopped, but this isn't the case.

Has anyone else come across this issue and managed to resolve it?


Edit:

I've found the following several times in the SharePoint logs:

Performance Counter OS (pdh) call failed with error code PDH_INVALID_HANDLE.     
 - Unhandled exception System.ComponentModel.Win32Exception: Unknown error (0xc0000bbc)     at Microsoft.SharePoint.Win32.SPPdh.CheckReturnValue(PDH_STATUS status, Boolean throwOnError)     at Microsoft.SharePoint.Utilities.SPPerformanceCounter.NextValue(Int32 retry, Int32 retryInterval)     at Microsoft.SharePoint.UserCode.SPUserCodePerformanceCounterHelper..ctor(String processName, Int32 processInstanceId) thrown while reading perf counters for process "SPUCWorkerProcess".  

This can apparently be caused by the 'SharePoint 2010 User Code Host' service running as a user that isn't in the required local user groups WSS_ADMIN_WPG and WSS_WPG. However, my service is using the 'Network Service' user, which is in both groups.

James Pritz has an interesting article on the matter, but his resolution(s) didn't work for me.

share|improve this question

4 Answers 4

check if the 'Microsoft SharePoint Foundation Sandboxed Code Service' service is started SharePoint 2010 Central Administration -> System Settings -> Manage Services on Server

share|improve this answer
    
I don't appear to have that option under System Settings, and neither does my colleague on his development box... –  Stuart Pegg Jun 24 '11 at 13:08
    
Its right under the "Server" headding. –  Heiko Hatzfeld Jun 24 '11 at 13:24
    
try this url: <central admin url>/_admin/Server.aspx –  Anand Jun 24 '11 at 13:38
    
@Heiko: Under that heading I have "Manage servers in this farm", but that's it. Is this a difference with Foundation perhaps? –  Stuart Pegg Jun 24 '11 at 13:39
    
@Anand: Ah! That worked, thanks. And yes, the service is started there. –  Stuart Pegg Jun 24 '11 at 13:42

This was the fix for me

Original link: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/0efa29a6-9bb1-4c2f-a4ef-113bb2601aa5/

regedit:

In HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance

If "Disable Performance Counters" is 1, set it to 0 !

Then start "SharePoint 2010 User Code host" in Services.

share|improve this answer
    
That appears to be the same as the last recommendation in the article I linked to in my question (by James Pritz). –  Stuart Pegg Mar 27 '12 at 9:21
    
The reg setting set to Zero fixes the issue but it seems after a few days it gets reset? How can I stop this from occuring? –  user8394 May 16 '12 at 16:13
up vote 0 down vote accepted

It has become increasingly obvious that reinstalling SharePoint is going to be necessary.

The symptoms seem to point to a permissions issue with the user accounts used to run the services, which are notoriously difficult to configure correctly outside of SharePoint's own installation process.

share|improve this answer
1  
Reinstall? Perhaps you should first try to run SharePoint configuration wizard before going for a reinstall? –  Janis Veinbergs Mar 27 '12 at 8:04
    
@JanisVeinbergs: I haven't got round to reinstalling yet, but I have run the configuration wizard on several occasions since. The service still has the same issue. –  Stuart Pegg Mar 27 '12 at 9:16

Try this Add User for service "SharePoint 2010 User Code Host" to "Performance Monitor Users" group.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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