SerializationException-找不到对象的构造函数(自定义图表Web部件)

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/13641

  •  16-10-2019
  •  | 
  •  

对于一个项目,我创建了一个来自ChartWebPart类的Web Part(为了相对设置数据源)。

SP:

SharePoint Server 2010(企业)

CS文件:

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.Office.Server.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace Cbs.PP.ProjectCosts.WebParts.ProjectExpensesChartWebPart
{
    [Serializable()]
    [ToolboxItemAttribute(false)]
    public class ProjectExpensesChartWebPart : ChartWebPart
    {
        public ProjectExpensesChartWebPart()
        { 
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }

    }
}

elements.xml:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
    <Module Name="ProjectExpensesChartWebPart" List="113" Url="_catalogs/wp">
      <File Path="ProjectExpensesChartWebPart\ProjectExpensesChartWebPart.webpart"
            Url="ProjectExpensesChartWebPart.webpart" 
            Type="GhostableInLibrary">
        <Property Name="Group" Value="CBS" />
      </File>
    </Module>
  </Elements>

部署Web-part并将其添加到网站上是没有问题的,但是当我尝试配置WebPart时,它会引发一个范围:

类型: 序列化exception 信息: 找不到“ [...]。projectexpenseschartwebpart”对象的构造函数。

*注意:翻译,因为我已经安装了德语版本的SP。原始:“DerFürDie DeSerialisierung eines objekts mit dem typ” [...]。projectexpenseschartwebpart“ erforderliche kontuktor wurdor wurde nicht gefunden”。

我希望有人有一个线索,这里有什么问题,或者至少可以指向我正确的方向。

另外, 堆栈跟踪:

bei system.runtime.serialization.ObjectManager.completeiserializableObject(Object OBJ,serializationInfo Info,StreamingContext上下文)
bei system.runtime.serialization.ObjectManager.dofixups() .Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) bei Microsoft.Office.Server.Internal.Charting 。 。 drecursive()bei system.web.ui.page.page.processrequestmain(boolean includestagesbeforeasyncpoint,boolean incluce incluce incluctages afterAsyncpoint)

有帮助吗?

解决方案

我认为您必须添加构造函数 ProjectExpensesChartWebPart(serializationinfo Info,StreamingContext上下文) 添加到默认构造函数上。

许可以下: CC-BY-SA归因
scroll top