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 : 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?
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.