PortalSiteMapProvider causing excessive SPRequest objects - sharepoint

We have a custom navigation webpart that uses the PortalSiteMapProvider of MOSS to build a menu navigation. It seems that the Provider is not managing it's objects. Any idea on how to manage the objects that are being created in the Provider?
It is causing log errors like so:
Potentially excessive number of SPRequest objects (9) currently unreleased on thread 1. Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed. Allocation Id for this object: {56D66DBA-AE72-42DF-A70F-B45E05A60A08} Stack trace of current allocation:
at Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable)
at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)
at Microsoft.SharePoint.SPWeb.InitializeSPRequest()
at Microsoft.SharePoint.SPWeb.EnsureSPRequest()
at Microsoft.SharePoint.SPWeb.get_Request()
at Microsoft.SharePoint.SPWeb.InitWebPublic()
at Microsoft.SharePoint.SPWeb.get_Exists()
at Microsoft.SharePoint.Publishing.CachedObjectFactory.CreateWebFromUrl(String url)
at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode..ctor(PortalWebSiteMapNode webNode, SPNavigationNode node, PortalSiteMapNode parentNode, NodeTypes type, String url, String title, String description)
at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.CreateSPNavigationSiteMapNode(PortalWebSiteMapNode webNode, SPNavigationNode node, PortalSiteMapNode parentNode)
at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.ProcessSPNavigationNode(SPNavigationNode node, SPNavigationNode previousSibling, PortalSiteMapNode parentNode)
at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMap.Node.PopulateNavigationChildren()
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(SiteMapNode node)
at System.Web.SiteMapNode.get_ChildNodes()
at Microsoft.SharePoint.Publishing.Navigation.PortalHierarchicalEnumerable.System.Collections.IEnumerable.GetEnumerator()
at System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem node, IHierarchicalEnumerable enumerable)
at System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem node, IHierarchicalEnumerable enumerable)
at System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item)
at System.Web.UI.WebControls.Menu.PerformDataBinding()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.Menu.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.Menu.EnsureDataBound()
at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript)
at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e)
at Microsoft.SharePoint.WebControls.AspMenu.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.VIEWPAGE_ASPX_2077083467.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpCont

Stefan Goßner's blog post seems to answer the question. The issue is not that the SPWeb objects are not being closed, but that once a certain threshold (defaults to 8) of allocations are hit, the warning is created in the log. Depending on your site structure the number that will be created will vary. Given the nested nature of navigation, the objects are kept open while the sub tree is traversed. So the objects are correctly disposed of, it is just that more than 8 (by default) are being held open at a given time.
See this question

Related

SharePoint 2019 random issue after authentication

We have a SharePoint 2019 environment with 4 WFE servers and a web application configured with FBA authentication.
We facing an issue which that when the users start accessing the web application normally one of the front end servers start getting the message (Sorry, something went wrong) after authentication, and preventing any user from accessing the site.
After (iisreset) that server the issue is resolved and the server start working normally.
The issue is repeated randomly on any front end server and we don't have a clear scenario to reproduce the issue.
When we browse the log we couldn't get the root cause of the issue:
Logging Correlation Data xmnv Medium Name=Request (GET:http://spsrv1:90/)
Asp Runtime avwhz Medium SPRequestModule.BeginRequestHandler End, SP Build Version: '16.0.10358.20000'
Claims Authentication bjkuz Medium Using input cookie name. CookieName: 'FedAuth'.
Application Authentication bjvyg Medium SPApplicationAuthenticationModule: Clear outgoing token context from SpThreadContext
Application Authentication bnksk Medium SPApplicationAuthenticationModule: Clear cross tenant token context from SpThreadContext
Asp Runtime avwh6 Medium SPRequestModule.PostAuthenticateRequestHandler Begin
Authentication Authorization agb9s Medium Non-OAuth request. IsAuthenticated=False, UserIdentityName=, ClaimsCount=0
Runtime ajd6k Medium Value for isAnonymousAllowed is : False
Runtime ajd6l Medium Value for checkAuthenticationCookie is : False
Asp Runtime avwh7 Medium SPRequestModule.PostAuthenticateRequestHandler End
Asp Runtime avwh8 Medium SPRequestModule.PostAuthorizeRequestHandler Begin
Reporting b5nni Medium PublishingHttpModule.PostAuthorizeRequestHandler: PublishingFriendlyUrl Start: My Scenario Start
Reporting bx9qw Medium TaxonomyNavigation: TryParseFriendlyUrlInternal Start: My Scenario Start
Publishing az6gu Medium CacheManager requested and used.
Reporting bx9q1 High TaxonomyNavigation: TryParseFriendlyUrlInternal ExpectedFailure: No matching term, this is not a FURL
Reporting b5nnj Medium PublishingHttpModule.PostAuthorizeRequestHandler: PublishingFriendlyUrl Success: My Scenario Success
Asp Runtime avwh0 Medium SPRequestModule.PostResolveRequestCacheHandler Begin
Asp Runtime avwh1 Medium SPRequestModule.PostResolveRequestCacheHandler End
Asp Runtime aj1kn Medium SPRequestModule.AcquireRequestStateHandler
Asp Runtime avwh2 Medium SPRequestModule.PostAcquireRequestStateHandler Begin
Asp Runtime avwh3 Medium SPRequestModule.PostAcquireRequestStateHandler End
Asp Runtime avwhu Medium SPRequestModule.PreRequestExecuteAppHandler Begin
Asp Runtime avwhw Medium SPRequestModule.ErrorAppHandler Begin
General 8nca Medium Application error when access /, Error=Provider name cannot be null or empty. at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Provider() at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Runtime tkau Unexpected System.ArgumentException: Provider name cannot be null or empty. at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Provider() at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
General ajlz0 High Getting Error Message for Exception System.ArgumentException: Provider name cannot be null or empty. at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Provider() at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Logging Correlation Data xmnv Medium Site=/
General aat87 Monitorable
General 8xfr Medium PermissionMask check failed for {0626C6DC-B973-4055-A2BF-09604FF70E44}. Asking for 0x00010000, have 0x00000000
Authentication Authorization bimbl Unexpected Failed to assert permission mask.
General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80070005
General aix9j High SPRequest.GetPageListId: UserPrincipalName=, AppPrincipalName= ,bstrUrl=https://spsrv1:90/
General ai1wu Medium System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace: at Microsoft.SharePoint.SPContext.get_ListId() at Microsoft.SharePoint.SPContext.get_List() at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound) at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page, ScriptDependency& dependency) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterStringsJsIfNecessary(String strFile, Page page) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound) at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.S...
General ai1wu Medium ...criptLink.RegisterOnDemand(Control ctrl, Page page, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPageInternal(String title, String message, String linkText, String linkUrl, Int32 statusCode) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() at System.Web.HttpApplication.RecordError(Exception error) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, ...
General ai1wu Medium ...HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
General 8xfr Medium PermissionMask check failed for {0626C6DC-B973-4055-A2BF-09604FF70E44}. Asking for 0x00010000, have 0x00000000
Authentication Authorization bimbl Unexpected Failed to assert permission mask.
General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80070005
General aix9j High SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=https://spsrv1:90/
General ai1wu Medium System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace: at Microsoft.SharePoint.SPWeb.InitWeb() at Microsoft.SharePoint.SPWeb.get_WebTemplate() at Microsoft.SharePoint.SPWeb.get_WebTemplateConfiguration() at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound) at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page, ScriptDependency& dependency) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterStringsJsIfNecessary(String strFile, Page page) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound) at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, B...
General ai1wu Medium ...oolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strFile, Boolean localizable) at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPageInternal(String title, String message, String linkText, String linkUrl, Int32 statusCode) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() at System.Web.HttpApplication.RecordError(Exception error) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRun...
General ai1wu Medium ...time.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
CSOM bhxdp Medium Experiment Manager: GetExpName user:
CSOM bhxdp Medium Experiment Manager: GetExpName cookie: unknown
CSOM bhxdp Medium Experiment Manager: GetExpName tenant: spsrv1:90
CSOM bhxdp Medium Experiment Manager: GetExpName final key:
CSOM bhxdp Medium Experiment Manager: GetExpName expName: production
CSOM bhxdp Medium Component Manager: public CreateInstance: Microsoft.SharePoint.Context.ContextInfo
CSOM bhxdp Medium Component Manager: Look in production
General bj421 Medium TryGetGridInformation from SPFarm.Local Start: My Scenario Start
General bj422 Medium TryGetGridInformation from SPFarm.Local Success: My Scenario Success
General 8xfr Medium PermissionMask check failed for {0626C6DC-B973-4055-A2BF-09604FF70E44}. Asking for 0x00010000, have 0x00000000
Authentication Authorization bimbl Unexpected Failed to assert permission mask.
General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80070005
General aix9j High SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=https://spsrv1:90/
General ai1wu Medium System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace: at Microsoft.SharePoint.SPWeb.InitWeb() at Microsoft.SharePoint.SPWeb.get_EnableMinimalDownload() at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPageInternal(String title, String message, String linkText, String linkUrl, Int32 statusCode) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() at System.Web.HttpApplication.RecordError(Exception error) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context,...
General ai1wu Medium ... AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
General 8xfr Medium PermissionMask check failed for {0626C6DC-B973-4055-A2BF-09604FF70E44}. Asking for 0x00010000, have 0x00000000
Authentication Authorization bimbl Unexpected Failed to assert permission mask.
General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80070005
General aix9j High SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=https://spsrv1:90/
General ai1wu Medium System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace: at Microsoft.SharePoint.SPWeb.InitWeb() at Microsoft.SharePoint.SPWeb.get_EnableMinimalDownload() at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPageInternal(String title, String message, String linkText, String linkUrl, Int32 statusCode) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() at System.Web.HttpApplication.RecordError(Exception error) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context,...
General ai1wu Medium ... AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
General agxkz High calling GetCurrentGenericSetupPath for a versioned path: TEMPLATE\LAYOUTS
Application Authentication arftr Medium SPApplicationAuthenticationModule.IsBearerChallengeRequested: Return 'False'.
Application Authentication bjkvg Medium At least one SPTrustedSecurityTokenIssuer is created.
Claims Authentication crpqx Medium STS setting for SuppressModernAuthForOfficeClients:'True'.
Application Authentication bjkut Medium IsClaimsTrustedAuthenticationOnly: 'False', IsOfficeClientIDCRLRequest: 'False', HasSPTrustedSecurityTokenIssuer: 'True', ForceIdcrlForOfficeClients: 'True'.
Asp Runtime avwh5 Medium SPRequestModule.PreSendRequestHeaders End
Asp Runtime avwhx Medium SPRequestModule.ErrorAppHandler End
Asp Runtime avwia Medium SPRequestModule.PostLogRequestHandler Begin
Asp Runtime avwib Medium SPRequestModule.PostLogRequestHandler End
Asp Runtime avwic Medium SPRequestModule.EndRequestHandler Begin
Micro Trace uls4 Medium Micro Trace Tags: 0 avwhy,0 nasq,1 avwhz,0 bjkuz,0 bjvyg,0 bnksk,0 avwh6,0 agb9s,0 ajd6k,0 ajd6l,0 avwh7,0 avwh8,0 b5nni,1 bx9qw,0 az6gu,0 bx9q1,0 b5nnj,0 avwh0,0 avwh1,0 aj1kn,0 avwh2,0 avwh3,0 avwhu,0 avwhw,0 8nca,0 tkau,0 ajlz0,11 aat87,1 aix9j,0 ai1wu,0 aix9j,0 ai1wu,0 bhxdp,0 bhxdp,0 bhxdp,0 bhxdp,0 bhxdp,0 bhxdp,0 bhxdp,6 bj421,0 bj422,5 aix9j,0 ai1wu,0 aix9j,0 ai1wu,2 agxkz,1 arftr,0 bjkvg,0 crpqx,0 bjkut,0 avwh5,1 avwhx,0 avwia,0 avwib,0 avwic
Runtime aoxsq Medium Sending HTTP response 200 for HTTP GET request
Unified Audit bm7sn Medium SPRequestModule::CreatePageViewedAuditEntry: Has PageViewed been suppressed for this request: True
Monitoring b4ly Medium Leaving Monitored Scope: (Request (GET:http://spsrv1:90/)) Execution Time=46.2549333333333; CPU Milliseconds=38; SQL Query Count=2; Parent=None
Asp Runtime avwid Medium SPRequestModule.EndRequestHandler End
Can anyone help us how to resolve this issue permanently?

Save Site as Template Programatically - Error generating solution files in temporary directory

I have a requirement like , i need to create the Site Templates programatically.
when i am trying to save the Site As Template Programatically , i am getting the below error.
"Error generating solution files in temporary directory".
i have given full control on c:\windows\temp directory.And I am using below Method:
oWeb.SaveAsTemplate(templateName, templateTitle, tmplDesc, true);
(or)
string solutionFileUrl = SPSolutionExporter.ExportWebToGallery(oWeb,templateName, templateTitle,tmplDesc,SPSolutionExporter.ExportMode.FullReuse,true);
facing the same issue.
i am able to save root web as Template like SPContext.Current.Web.SaveAsTemplate(templateName, templateTitle, tmplDesc, true);
but i need to save sub site as Template.
Below is my ULS log dump
System.Runtime.InteropServices.COMException: List does not exist. The
page you selected contains a list that does not exist. It may have
been deleted by another
user.0x81020026,
StackTrace: at
Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId,
String strListName) at
Microsoft.SharePoint.SPListCollection.ItemByInternalName(Guid webId,
String listName) at
Microsoft.SharePoint.WebPartPages.ListViewWebPart.EnsureList() at
Microsoft.SharePoint.WebPartPages.ListViewWebPart.EnsureListAndView(Boolean
requireFullBlownViewSchema) at
Microsoft.SharePoint.WebPartPages.ListViewWebPart.ShouldSerializeTitle()
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterListViewWebPart.Write14_ListViewWebPart...
...(String n, String ns, ListViewWebPart o, Boolean isNullable,
Boolean needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterListViewWebPart.Write15_WebPart(Object
o) at System.RuntimeMethodHandle.InvokeMethod(Object target,
Object[] arguments, Signature sig, Boolean constructor) at
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments) at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Xml.Serialization.TempAssembly.InvokeWriter(XmlMapping
mapping, XmlWriter xmlWriter, Object o, XmlSerializerNamespaces
namespaces, String encodingStyle, String id) at
System.Xml.Serialization.XmlSerializer.S... ...erialize(XmlWriter
xmlWriter, Object o, XmlSerializerNamespaces namespaces, String
encodingStyle, String id) at
Microsoft.SharePoint.WebPartPages.WebPart.SerializeXml(XmlWriter
writer, XmlSerializer xmls, Boolean shouldSerializeAll) at
Microsoft.SharePoint.WebPartPages.WebPart.SerializeWebPartXml(Boolean
shouldExcludeSpecialProperties, TextWriter writer) at
Microsoft.SharePoint.WebPartPages.WebPart.WriteXmlAsUtf8(Boolean
shouldExcludeSpecialProperties) at
Microsoft.SharePoint.WebPartPages.SPWebPartManager.GetWebPartXml(WebPart
webPart, Boolean shouldUTF8Encode, Boolean
shouldExcludeSpecialProperties, Boolean export) at
Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.ExportWebPart(WebPart
webPart, XmlWriter writer) at
Microsoft.SharePoint.SPSolutionExporter...
....GetFilesInFolderTree(SPFolder folder, SortedList2 filesInFolder,
List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInFolderTree(SPFolder
folder, SortedList2 filesInFolder, List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInFolderTree(SPFolder
folder, SortedList2 filesInFolder, List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInWeb(String
workflowTemplateName) at
Microsoft.SharePoint.SPSolutionExporter.GenerateSolutionFiles() at
Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution() at
Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web,
String solutionFileName, String title, String description, ExportMode
exportMode, Boolean includeContent, String workflowTemplateName,
String destina... ...tionListUrl, Action`1 solutionPostProcessor,
Boolean activateSolution) at
Microsoft.SharePoint.SPWeb.SaveAsTemplate(String strTemplateName,
String strTemplateTitle, String strTemplateDescription, Boolean
fSaveData) at
TemplateIssueProject.ProjectTemplate.<>c__DisplayClass9.b__6()
at
Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.b__3()
at
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated
secureCode) at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback
secureCode, Object param) at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
secureCode) at
TemplateIssueProject.ProjectTemplate.SaveTemplate(String webName,
String templateName, String template... ...Title, String tmplDesc)
at TemplateIssueProject.ProjectTemplate.SiteCreation(String siteName)
at
TemplateIssueProject.TemplateIssewebpart.TemplateIssewebpart.btnSubmit_Click(Object
sender, EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
ASP.WKPSTD_ASPX__1961116010.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecut...
...ionStep.Execute() at
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) at
System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception
error) at
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
context, AsyncCallback cb) at
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) at
System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData,
Int32 flags) at
System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr
rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData,
Int32 flags) at
System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletio...
...n(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
pHandler, RequestNotificationStatus& notificationStatus) at
System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData,
Int32 flags) at
System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr
rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData,
Int32 flags)
System.NullReferenceException: Object reference not set to an instance
of an object. at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInFolderTree(SPFolder
folder, SortedList2 filesInFolder, List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInFolderTree(SPFolder
folder, SortedList2 filesInFolder, List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInFolderTree(SPFolder
folder, SortedList2 filesInFolder, List1 webViews) at
Microsoft.SharePoint.SPSolutionExporter.GetFilesInWeb(String
workflowTemplateName) at
Microsoft.SharePoint.SPSolutionExporter.GenerateSolutionFiles() at
Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution()
Application error when access /SitePages/MyTaskPage.aspx, Error=Error
generating solution files in temporary directory. at
TemplateIssueProject.ProjectTemplate.SiteCreation(String siteName)
at
TemplateIssueProject.TemplateIssewebpart.TemplateIssewebpart.btnSubmit_Click(Object
sender, EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
System.InvalidOperationException: Error generating solution files in
temporary directory. at
TemplateIssueProject.ProjectTemplate.SiteCreation(String siteName)
at
TemplateIssueProject.TemplateIssewebpart.TemplateIssewebpart.btnSubmit_Click(Object
sender, EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Please suggest/provide suggestions.
Regards,
below code is used to save the site as Template(Root Level/subsite)
using System.Management;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
Add Reference to your solution from the below path.
Reference Path: C:\Windows\winsxs\msil_system.management.automation_31bf3856ad364e35_7.1.7601.18071_none_a682d4c5c360dacf\System.Management.Automation.dll
RunspaceInvoke oRunSpaceInvoke = new RunspaceInvoke();
FullWebUrl = SPContext.Current.Site.Url + "/" + objTemplate.strWebName;
strScriptToSaveTemp = #"Add-PSSnapin Microsoft.SharePoint.PowerShell ; Set-ExecutionPolicy -ExecutionPolicy RemoteSigned ;" +
"$oWeb = Get-SPWeb " + FullWebUrl + " ; $oWeb.SaveAsTemplate('" + objTemplate.strTemplateTitle + "','" + objTemplate.strTemplateName + "','" + objTemplate.strTemplateDesc + "',1) \n";
oRunSpaceInvoke.Invoke(strScriptToSaveTemp).ToString();
Regards,
Mahesh
http://sharepointchampion.blogspot.in/2014/05/save-site-as-template-programatically.html
If you have added any fields through a feature, and your field has Overwrite="FALSE", then site exporting will fail. You should only use Overwrite if you need to set it to TRUE, since the default is FALSE.
This seems to be a SharePoint bug.
You may see this attribute mentioned in your ULS logs.

Post Updating of ServiceAppointment entity giving strange error

We're trying to update CRM 2011 from RU 11 to RU 14 to be able to install RU 15 when RU 14 is all ready to go. Been fixing various issues concerning this update since Microsoft did quite some changes due to the Cross Platform and obviously since were moving from the 11 to the 14.
Now, my main issue is that I have a plugin that's running synchronously on the create of a service appointment. It's in charge of doing several things, like comparing values or using values from other entities to populate data in the Service Activity record. Regarding what the strange error is, since changes are being done on a Post Operations, a _service.Update(entity) has to be done in order for changes to be seen in the form and database. If I debug the code step by step everything passes smoothly except when the code reaches the .Update. When the update is called CRM throws an Unexpected Error Occured. When I go to the TraceLogs this is what I find:
[2013-12-10 14:49:56.323] Process: w3wp |Organization:3e484d20-6245-e311-8a60-00155d6f6b34 |Thread: 20 |Category: Platform.Sdk |User: 0a51b463-df74-e011-81b3-00155d7a7a17 |Level: Error |ReqId: dca72532-8bed-491c-9295-62211d39a6f6 | VersionedPluginProxyStepBase.Execute ilOffset = 0x65
at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) ilOffset = 0x65
at Pipeline.Execute(PipelineExecutionContext context) ilOffset = 0x65
at MessageProcessor.Execute(PipelineExecutionContext context) ilOffset = 0x1C5
at InternalMessageDispatcher.Execute(PipelineExecutionContext context) ilOffset = 0xE4
at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion) ilOffset = 0x156
at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse) ilOffset = 0x145
at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) ilOffset = 0x34
at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) ilOffset = 0x24
at InprocessServiceProxy.ExecuteCore(OrganizationRequest request) ilOffset = 0x34
at SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest) ilOffset = 0xAC
at ilOffset = 0xFFFFFFFF
at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) ilOffset = 0x241
at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) ilOffset = 0x100
at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) ilOffset = 0x48
at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) ilOffset = 0xC6
at MessageRpc.Process(Boolean isOperationContextSet) ilOffset = 0x62
at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) ilOffset = 0x256
at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) ilOffset = 0xF1
at ChannelHandler.AsyncMessagePump(IAsyncResult result) ilOffset = 0x39
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) ilOffset = 0x0
at AsyncResult.Complete(Boolean completedSynchronously) ilOffset = 0xC2
at TryReceiveAsyncResult.OnReceive(IAsyncResult result) ilOffset = 0x4B
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) ilOffset = 0x0
at AsyncResult.Complete(Boolean completedSynchronously) ilOffset = 0xC2
at ReceiveAsyncResult.OnReceiveComplete(Object state) ilOffset = 0x2B
at SessionConnectionReader.OnAsyncReadComplete(Object state) ilOffset = 0xBC
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) ilOffset = 0x0
at LazyAsyncResult.Complete(IntPtr userToken) ilOffset = 0x3E
at NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) ilOffset = 0x70
at NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest) ilOffset = 0x68
at FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes) ilOffset = 0x5D
at FixedSizeReader.ReadCallback(IAsyncResult transportResult) ilOffset = 0x29
at AsyncResult.Complete(Boolean completedSynchronously) ilOffset = 0xC2
at IOAsyncResult.OnAsyncIOComplete(Object state) ilOffset = 0x26
at SocketConnection.OnReceiveAsync(Object sender, SocketAsyncEventArgs eventArgs) ilOffset = 0x57
at SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags) ilOffset = 0x5CB
at SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) ilOffset = 0x10
at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) ilOffset = 0x3C
>Web Service Plug-in failed in SdkMessageProcessingStepId: {B9CDBB1B-EA3E-DB11-86A7-000A3A5473E8}; EntityName: serviceappointment; Stage: 30; MessageName: Update; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: **Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.**
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
**Inner Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.**
Parameter name: index
at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
at Microsoft.Crm.BusinessEntities.BusinessEntityCollection.get_Item(Int32 index)
at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.UpdateCommunicationPartiesInternal(BusinessEntityMoniker moniker, CommunicationActivity activity, ExecutionContext context, ExtensionEventArgs e)
at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.UpdateCommunicationParties(Object sender, ExtensionEventArgs e)
at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostUpdateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
at Microsoft.Crm.ObjectModel.GenericActivityServiceBase.UpdateInternal(IBusinessEntity entityInterface, ExecutionContext context)
at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.Update(IBusinessEntity entityInterface, ExecutionContext context)
_______________
I've done different changes trying to figure out what the problem would be, among them, turning off all registered plugins other than Microsoft ones and this one. Turned off all JavaScript in the form in case any values are being changed that are making it throw the error, hard coded State Code and Status Code because of some related issues found online, commented ALL the code in the plugin and only left the _service.Update(entity) in case an invalid value was being passed but update would still throw error, and other things I found online that seemed like a solution. I've been going on this error for some time now and would like to have some more minds thinking this out with me. The plugin has to be run Synchronously and in the Post Operation because of logic tied to the plugin.
Any help is appreciated and if you need any more information to understand what could be going on please let me know.
I've been tearing my hair out of the exact same issue. My same code works fine on other types of entities, so I isolated it only occurring on a activities (i.e. anything that uses ActivityBase). This looks like a bug within CRM's internal object model (present at least in UR11, which is the version I'm running) that occurs in the following circumstance:
You're triggering a plugin that is:
against is an Activity (Appointment, Service Activity, Task, Email, etc) or custom Activity Type
Triggered on the Create message
Run Synchronously
Runs Post-Operation
One of the features that all Activity entities have compared to other entities that is the presence of activity participants (ActivityParties), which are standard fields like 'Attendees', 'Customers', useful email fields ('To', 'CC', 'BCC'), which can contain a number of different types such as 'RequiredAttendee', 'Organizer', 'To', but also importantly it creates one for the record 'Owner' too (see http://msdn.microsoft.com/en-us/library/gg328549.aspx for the full list).
After looking at the SQL that's being executed (and also a sneaky peek in a .NET decompiler within Microsoft.Crm.ObjectModel) it appears that the issue lies with the order in which the Activity Parties are (or aren't) being created or updated. For activities after the usual Create() message processing (including your plugin code) is finished executing, these ActivityParty record(s) (including one for the Owner) are populated from the entity data. On Update() there is also a check that processes any changes required to the ActivityParties, however this (erroneously) assumes that ActivityParty records have already been created.
..so if you're calling Update within the Create message, then the initial Create message hasn't finished before the Update ActivityParty throws it's ArgumentOutOfRangeException as it doesn't have any records yet.
This also explains why it works as expected in Async mode, as the ActivityParties are created successfully right after the usual Create() process but before the Update triggered by the plugin execution code runs a few seconds later.
Depending upon what you're trying to achieve, as a work around it might be possible to rework your plugin to function on the Pre-Operation event instead.

Sharepoint event receiver and linq to sharepoint

I have a sandboxed solution and access some lists with Linq-to-Sharepoint. Now I attached an event receiver to the list type 101 because I have to restrict some files uploaded to picture libraries. This works fine.
But now my Linq-to-Sharepoint throws an error when I try to insert a new item to a list (only with Linq, it works fine if I create new items on that list via the regular user interface).
The error is 0x81020089 with the message The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request. but the message is just default as the host service is not too busy and 0x81020089 is kind of a problem with an event receiver.
Everything works fine if I dont attach the event receiver but the error occurs when I do so - even if there is no code in the event receiver at all.
Any ideas?
Error message
0x81020089 The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.
Server stack trace
at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename)
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename)
at Microsoft.SharePoint.SPListItem.Update()
at Microsoft.SharePoint.SPListItem_SubsetProxy.Update__Inner()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Place the following in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\RPC
That key just has to be present. You don't need a value. Also, you will have to place that key in every registry that is running the Sandboxed Code Host Service. Once you do that, I would recommend that you restart the machine.
Here is a great blog article in regards to this issue.
http://blogs.msdn.com/b/sharepointdev/archive/2011/02/08/error-the-sandboxed-code-execution-request-was-refused-because-the-sandboxed-code-host-service-was-too-busy-to-handle-the-request.aspx
I faced the same issue and the problem was an error (Object reference not set to an instance of an object) that is happening on the ItemUpdating event receiver.. debug should tell you what is missing..
when you use linq to sharepoint, the AfterProperties are only the properties that are changed by code, which is different that the UI update where all properties will be considered as changed

Unable to update OptionSetValue field on CRM 2011 custom Entity

I'm getting a "Specified cast is not valid." Exception when trying to update an OptionSetValue attribute of a custom field on a custom entity.
This works:
data = new Xrm.Xyz_data()
{
Xyz_dataId = (Guid)entity["xyz_dataId"],
// Xyz_dataStatus = new OptionSetValue(5),
Xyz_IsSyncReqd = true
};
service.Update(data);
But uncomment the OptionSetValue line and it throws this exception:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: Specified cast is not valid. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
With this stack trace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
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.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Update(Entity entity)
That looks right to me - I don't use early bound which it looks like you are doing but can you verify that the data context has been refreshed since the picklist attribute was created and published?
If this is a built in state field you will probably need to first do the update and then perform a UpdateStateValueRequest. Excerpt from CRM 2011 SDK -
#region How to update state value
// Modify the state value label from Active to Open.
// Create the request.
UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest
{
AttributeLogicalName = "statecode",
EntityLogicalName = Contact.EntityLogicalName,
Value = 1,
Label = new Label("Open", _languageCode)
};
// Execute the request.
_serviceProxy.Execute(updateStateValue);
#endregion How to update state value
So I finally figured out what was happening. I turned on server side debugging using the same registry settings as CRM 4.0:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM]
"TraceEnabled"=dword:00000001
"TraceCategories"="*:Error"
"TraceCallStack"=dword:00000001
"TraceRefresh"=dword:00000001
I reran my test that was failing, and found this error:
[2011-10-24 18:19:37.990] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 14 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
at ExceptionConverter.ConvertMessageAndErrorCode(Exception exception, Int32& errorCode)
at ExceptionConverter.ToSingleFaultOther(Exception exception)
at ExceptionConverter.ToSingleFaultUntyped(Exception exception)
at ExceptionConverter.ConvertToFault(Exception exception)
at ExceptionConverter.TryConvertToFaultExceptionInternal(Exception exception, Boolean createNewFaultException, FaultException`1& faultException)
at FaultHelper.ConvertToFault(Exception exception)
at OrganizationSdkServiceInternal.Update(Entity entity, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
at
at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at MessageRpc.Process(Boolean isOperationContextSet)
at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
at ChannelHandler.AsyncMessagePump(IAsyncResult result)
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at AsyncResult.Complete(Boolean completedSynchronously)
at ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result)
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at AsyncResult.Complete(Boolean completedSynchronously)
at AsyncQueueReader.Set(Item item)
at InputQueue`1.Dispatch()
at ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
>System.InvalidCastException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #9F125FAE: System.InvalidCastException: Specified cast is not valid.
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.IntentionalRethrow(Exception chainException, Exception originalException)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.RethrowRecommended(Exception chainException, Exception originalException)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.Handle(Exception exceptionToHandle)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl.HandleException(Exception exceptionToHandle)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName, ExceptionPolicyFactory policyFactory)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at Common.Services.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at XYZ.CRM.Common.Services.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at XYZ.CRM.Plugin.Common.PluginBase.OnError(Exception ex)
> at XYZ.CRM.Plugin.Common.PluginBase.Execute(IServiceProvider serviceProvider)
> at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
> at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
And since I was debugging my plugin via a unit test, I realized that another plugin was getting fired when those fields were updated by my plugin, and that plugin was apparently causing an exception. But even worse was that the exception handler was causing another exception, that was getting returned, masking the true exception. I tested a really simple fix by eating any exceptions that the exception handler might throw, and it is working great now! Now to discover why my other plugin is failing...

Resources