一.环境:SharePoint 2016 + Visual Studio 2015,

二.错误描述:

错误1:帮朋友写个计时器Demo,部署位置GAC,来回部署几次后,vs2015报错:

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 Error occurred in deployment step 'Retract Solution': SP_CustomTimerJob.ListTimerJob 无法反序列化,因为它没有公共的默认构造函数。

错误2:打开管理中心—监控—复查作业,也报错:

SP_CustomTimerJob.ListTimerJob 无法反序列化,因为它没有公共的默认构造函数。

错误3:重新运行配置向导,继续报错:

System.MissingMethodException: SP_CustomTimerJob.ListTimerJob cannot be deserialized because it does not have a public default constructor

其他错误:使用各种命令卸载wsp或者删除TimerJob,都会报上面的错误。整个状态就是卸不掉,删不掉。

三.解决步骤:

首先,当vs报错时,我着魔似的顺手把对应的Feature用PowerShell给删除了,导致通过正常途径(包括命令)再也删不掉wsp了(这个坑害的我用了几乎一天才爬上来)。

教训就是,不要手动删除wsp包中的feature,要通过卸载wsp包的方式来移除feature。

报错的原因是继承SPJobDefinition的类里,没有提供默认的构造函数。类似如下:

解决办法,修改继承的SPJobDefinition类,添加需要的构造函数。然后用vs重新生成一下(用vs部署会失败)。

下面就是用gacutil.exe工具,把项目的dll注册到GAC里。这是最关键的一步。完成后,会发现管理中心的"复查作业"可以进去了。

剩下的就是用命令强制移除原来的wsp包,然后重新添加,然后重新强制安装wsp包。

参考:

https://bernado-nguyen-hoan.com/2010/06/03/cant-retract-sharepoint-timer-job-because-the-job-cannot-be-deserialized-because-it-does-not-have-a-public-default-constructor/

https://sharepoint.stackexchange.com/questions/193490/solution-cannot-be-deserialized-because-it-does-not-have-a-public-default-constr

Error occurred in deployment step 'Retract Solution': xxx 无法反序列化,因为它没有公共的默认构造函数的更多相关文章

  1. Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.

    Sharepoint 部署的时候出现一个错误 Error occurred in deployment step 'Add Solution': Operation is not valid due ...

  2. SharePoint Error occurred in deployment step 'Recycle IIS Application Pool': 0x80070005:拒绝访问

    错误出现的前提:多个用户在一台机器上做开发,使用非系统管理员账号时会出现,因为一般创建网站集时指定管理员为系统管理员: 使用 Visual Studio 2010 部署时报错:Error occurr ...

  3. eclipse - An internal error occurred during: "Running Android Lint"

    概述 也不晓得为什么,编译eclipse,设置打开,就自动报错: An internal error occurred during: "Running Android Lint" ...

  4. 学习jvm,关于MAT an internal error occurred during:"Parsing heap dump" from问题

    写了一个死循环不断的创建对象,模拟内存溢出 package com.zuo.test1; import java.util.ArrayList; import java.util.List; publ ...

  5. An internal error occurred during: "Launching xxx on WebLogic10.x".

    An internal error occurred during: "Launching xxx on WebLogic10.x". java.lang.NullPointerE ...

  6. Dynamics CRM 2011 2013-(An error occurred while opening mailbox xxx@xx.com Microsoft.Crm.Tools.Email.Providers.)

    An error occurred while opening mailbox  Microsoft.Crm.Tools.Email.Providers. Whenever I check how C ...

  7. idea报错:[2016-08-31 09:20:10,763] Artifact xxx:war exploded: Error during artifact deployment.

    [2016-08-31 09:20:10,763] Artifact newClassProject1:war exploded: Error during artifact deployment. ...

  8. [DeploymentService:290066]Error occurred while downloading files from admin server for deployment request "0". Underlying error is: "null"

    weblogic 莫名无法启动: <Apr , :: PM CST> <Error> <Deployer> <BEA-> <Failed to i ...

  9. Mysql Solution - Timeout error occurred trying to stop MySQL Daemon. Stopping MySQL: [FAILED] -

    错误例如以下: Timeout error occurred trying to stop MySQL Daemon. Stopping mysqld:                         ...

随机推荐

  1. Maccms8.x 命令执行漏洞分析

    下载链接https://share.weiyun.com/23802397ed25681ad45c112bf34cc6db 首先打开Index.php $m = be('get','m'); m参数获 ...

  2. golang channle close() x,ok := <- c

    close为内置函数 close内置函数关闭一个通道channle,其效果为:在最后的值从已关闭的信道中被接收后,任何对其的接收操作都会无阻塞的成功.对于已关闭的信道使用v,ok := <-   ...

  3. python --端点调试

    python端点调试 左边三角:快速跳到下一个端点 下箭头:单不调试 斜向下箭头:跳到函数内部执行代码

  4. linux大法好。。。。。

    vim: 移动光标至段首:^或者home键 移动光标至段尾:$或者end键 删除光标位置到本行开头:d0或者d^ 删除光标位置到本行末尾:D或者d$ 撤销操作:u 取消撤销操作:ctrl+r ---- ...

  5. SpringBoot系列: 单元测试

    SpringBoot 项目单元测试也很方便, Web项目中单元测试应该覆盖:1. Service 层2. Controller 层 本文前半部分讲解是一些测试基础配置. 对于Service和Contr ...

  6. VS2019预览版发布了

     VS2019正式版已发布:https://www.cnblogs.com/zhaogaojian/p/10648904.html 1.点击下载https://visualstudio.microso ...

  7. [译]使用Command模式和MediatR简化你的控制器

    原文 你希望保持你的controller足够简单. 你的controller越来越臃肿,你听说command模式是一个给controller瘦身的解决方案. 但是你不知道command模式是否适合你的 ...

  8. Docker 容器启动 查看容器状态 - 四

    1.容器两种方式进行启动 一种是基于创建一个容器并启动 docker create docker start 另一种 使用 run 创建自动启动:是状态下的停止 启动 docker start ngi ...

  9. [SYSS-2018-033]: Fujitsu Wireless Keyboard Set LX901 - Keystroke Injection Vulnerability

    风险简介: [SYSS-2018-033]:富士通无线键盘组LX901 -击键注入漏洞 风险报告ID: sys - 2018 - 033 产品:无线键盘套件LX901 制造商:富士通 受影响版本:型号 ...

  10. [C++]PAT乙级1002.写出这个数(20/20)

    /* 1002. 写出这个数 (20) 读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式:每个测试输入包含1个测试用例,即给出自然数n的值.这里保证n小于10^100. ...