Can TaxonomySession be used at SharePoint visual web part and web part on sandbox? I tested a simple code as following,
protected void Page_Load(object sender, EventArgs e) { try{
SPSite currentSite = SPContext.Current.Site; TaxonomySession taxonomySession = new TaxonomySession(currentSite); } catch (Exception ex) { } finally{} }
and got the error message as below,
Web Part Error: Sandboxed code execution request failed.
[SPUserCodeExecutionPipelineFailedException: Sandboxed code execution request failed.] 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)
[RemotingException: Server encountered an internal error. For more information, turn off customErrors in the server's .config file.]
Server stack trace:
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)