Namespace exception - subsonic

I'm getting the following exception on a web site hosted by Fasthosts. It's only recently started and is resolved by editing web.config thereby recycling the app. Problem is it comes back every 2 week or so. Any ideas anyone?
Exception Details: System.ArgumentException: The given name 'NHSSBS' matches at least two names in the collection object with different namespaces.
Source Error:
Line 32: string pageDatabasePath = SiteStructure.GetDatabasePath(Request.AppRelativeCurrentExecutionFilePath);
Line 33:
Line 34: SubSonic.Query query = new SubSonic.Query("Metatag");
Line 35: query.QueryType = SubSonic.QueryType.Select;
Line 36: query.WHERE("Path", pageDatabasePath);
Source File: e:\DOMAINS\s\sbs.nhs.uk\user\htdocs\UserControls\HTMLHead.ascx.cs Line: 34
Stack Trace:
[ArgumentException: The given name 'NHSSBS' matches at least two names in the collection object with different namespaces.]
System.Data.DataTableCollection.get_Item(String name) +1770251
SubSonic.SqlDataProvider.GetTableSchema(String tableName, TableType tableType) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\DataProviders\SqlDataProvider.cs:430
SubSonic.DataService.GetSchema(String tableName, String providerName, TableType tableType) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\DataProviders\DataService.cs:426
SubSonic.DataService.GetTableSchema(String tableName, String providerName) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\DataProviders\DataService.cs:440
SubSonic.Query.BuildTableSchema(String tableName, String providerName) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\Sql Tools\Query.cs:497
SubSonic.Query.BuildTableSchema(String tableName) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\Sql Tools\Query.cs:492
SubSonic.Query..ctor(String tableName) in C:\Program Files\SubSonic\SubSonic 2.0.3\src\SubSonic\Sql Tools\Query.cs:651
UserControls_HTMLHead.SetupMetatags() in e:\DOMAINS\s\sbs.nhs.uk\user\htdocs\UserControls\HTMLHead.ascx.cs:34
UserControls_HTMLHead.Page_Load(Object sender, EventArgs e) in e:\DOMAINS\s\sbs.nhs.uk\user\htdocs\UserControls\HTMLHead.ascx.cs:27
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

I'm going to guess you have duplicate DLLs in your /bin with a different name.

Related

Error Generating a WSDL File in 2017 R2 17.200.0401

I am trying to generate a WSDL file for screen CA30400 and when I click on Tools -> Web Service I get the following error:
Object reference not set to an instance of an object.
Line 7: public override void ProcessRequest(HttpContext context)
Line 8: {
Line 9: WsdlBuilder.ProcessHelpRequest(context);
Line 10: }
Line 11: }
Source File: g:\projects\XXXX\Automatica\Projects\XXXX\Website\Frames\WsdlHelp.aspx.cs Line: 9
[NullReferenceException: Object reference not set to an instance of an object.]
PX.Data.Process.PXScreenProcessor.HackEtwTrace(Boolean s) +251
PX.Data.Process.PXScreenProcessor.Process(String uri, IPrincipal user, AsyncCallback cb, Action`1 initContext) +2039
PX.Api.ScreenUtils.GetScreenInfoWithoutHttpContext(String screenID) +918
PX.Api.Soap.Screen.WsdlBuilder.GetWsdl(String screenID) +111
PX.Api.Soap.Screen.WsdlBuilder.ProcessHelpRequest(HttpContext context) +989
Frames_WsdlHelp.ProcessRequest(HttpContext context) in g:\projects\MindOver-Software\Automatica\Projects\RollingDough\Website\Frames\WsdlHelp.aspx.cs:9
ASP.frames_wsdlhelp_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\XXXX\9639ed8b\31eb9aa7\App_Web_5fegsf0t.6.cs:0
System.Web.Services.Protocols.DocumentationServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream) +646
[InvalidOperationException: The XML Web service help page encountered an internal error.]
System.Web.Services.Protocols.WebServiceHandler.WriteException(Exception e) +229988
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() +958
System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +866
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91
This is a new installation

Acumatica Error: 'AP Sub.' cannot be empty

In Acumatica I am trying to update payment instructions on a location for a supplier and it wont allow me to save saying Error: 'AP Sub.' cannot be empty.
I am not using sub accounts at all and the GL accounts tab is filled out.
After getting the message a trace shows the following:
Error: Error: 'AP Sub.' cannot be empty. Send
Raised At: 26/06/2017 1:19:58 AM Screen: AP.30.30.10 Command: Save
26/06/2017 1:19:58 AM Error:
Error: 'AP Sub.' cannot be empty.
at MYOB.AdvancedLive.Core.Extensions.AP.VendorLocationMaintExtension.Location_RowPersisting(PXCache sender, PXRowPersistingEventArgs args, PXRowPersisting handler)
at PX.Data.PXRowPersisting.Invoke(PXCache sender, PXRowPersistingEventArgs e)
at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation)
at PX.Data.PXCache`1.PersistUpdated(Object row)
at PX.Data.PXCache`1.Persist(PXDBOperation operation)
at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation)
at PX.Data.PXGraph.Persist()
at PX.Objects.CR.LocationMaint.Persist()
at PX.Objects.AP.VendorLocationMaint.Persist()
at PX.Data.PXSave`1.d__2.MoveNext()
at PX.Data.PXAction`1.d__31.MoveNext()
at PX.Data.PXAction`1.d__31.MoveNext()
at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows)
at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
Based on attached stack trace, the exception is thrown inside Location_RowPersisting event handler declared within the MYOB.AdvancedLive.Core.Extensions.AP.VendorLocationMaintExtension class. I would recommend contacting MYOB support and ask them to further review this issue.

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.

Unable to use PostFile to upload image

I am trying to use PostFile to upload an image. As a simple example I have the following DTO:
[Route("/Pictures/{Id}", "GET, PUT, DELETE")]
public class Picture
{
public int Id { get; set; }
}
public class PictureResponse : IHasResponseStatus
{
public int Id { get; set; }
#region Implementation of IHasResponseStatus
public ResponseStatus ResponseStatus { get; set; }
#endregion
}
My GET works fine:
public override object OnGet(Picture request)
{
var memoryStream = new MemoryStream();
PictureRepository.Get(request.Id).Save(memoryStream, ImageFormat.Png);
return new HttpResult(memoryStream, "image/png");
}
But my PostFile blows up:
var imagePathInfo = new FileInfo(#"C:\Users\Mark\Downloads\avatars\symang.jpg");
var serviceClient = new JsonServiceClient("http://localhost:52712/api")
serviceClient.PostFile<PictureResponse>("/Pictures/{0}".Fmt(id), imagePathInfo, MimeTypes.GetMimeType(imagePathInfo.Name));
Here's the error and stack trace:
Server Error in '/' Application.
An existing connection was forcibly closed by the remote host
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Source Error:
Line 32: var imagePathInfo = new FileInfo(#"C:\Users\Mark\Downloads\avatars\symang.jpg");
Line 33: var serviceClient = new JsonServiceClient("http://localhost:52712/api");
Line 34: serviceClient.PostFile<PictureResponse>("/Pictures/{0}".Fmt(id), imagePathInfo, MimeTypes.GetMimeType(imagePathInfo.Name));
Line 35: RedirectToAction("Index");
Line 36: return View();
Source File: C:\Users\Mark\Documents\Visual Studio 2010\Projects\Sandbox\UploadFileAttachments\UploadFileAttachments\Controllers\HomeController.cs Line: 34
Stack Trace:
[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +6210712
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +134
[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size) +318
System.Net.HttpWebRequest.MakeMemoryStream(Stream stream) +221
[WebException: The underlying connection was closed: An unexpected error occurred on a receive.]
System.Net.HttpWebRequest.GetResponse() +6115603
ServiceStack.ServiceClient.Web.ServiceClientBase.PostFile(String relativeOrAbsoluteUrl, Stream fileToUpload, String fileName, String mimeType) in C:\src\ServiceStack\src\ServiceStack.Common\ServiceClient.Web\ServiceClientBase.cs:815
ServiceStack.ServiceClient.Web.ServiceClientBase.PostFile(String relativeOrAbsoluteUrl, FileInfo fileToUpload, String mimeType) in C:\src\ServiceStack\src\ServiceStack.Common\ServiceClient.Web\ServiceClientBase.cs:790
UploadFileAttachments.Controllers.HomeController.ChangePicture(Int32 id) in C:\Users\Mark\Documents\Visual Studio 2010\Projects\Sandbox\UploadFileAttachments\UploadFileAttachments\Controllers\HomeController.cs:34
lambda_method(Closure , ControllerBase , Object[] ) +150
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
I'm sure I must be misunderstanding how to use PostFile. By the way, I never hit my OnPost method on my service. Thanks for any insights.
PostFile does a HTTP POST.
But your service only allows GET, PUT and DELETE because of your route in the first line of your example code:
[Route("/Pictures/{Id}", "GET, PUT, DELETE")]
Solution:
Either include POST in your route:
[Route("/Pictures/{Id}", "GET, PUT, DELETE, POST")]
...or just omit the HTTP verbs:
[Route("/Pictures/{Id}")]

PortalSiteMapProvider causing excessive SPRequest objects

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

Resources