一.环境: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. C#设计模式(11)——装饰者模式

    1.装饰者模式介绍 装饰者顾名思义就是对一个类添加一些额外的装饰(功能).我们想给一个对象添加一些额外的功能又不改变对象内方法的签名怎么做呢?最常用的方法就是继承了,子类继承父类,然后重写父类的方法. ...

  2. spring+springmvc+ibatis整合注解方式实例【转】

    源自-----> http://shaohan126448.iteye.com/blog/2033563 (1)web.xml文件(Tomcat使用) 服务器根据配置内容初始化spring框架, ...

  3. bash 刷题leetcode

    题目一: 给定一个文本文件 file.txt,请只打印这个文件中的第十行. 示例: 假设 file.txt 有如下内容: Line 1 Line 2 Line 3 Line 4 Line 5 Line ...

  4. 一些优秀的Python包

    总结一下我使用到的一些比较优秀的Python package =========================通用包========================= Werkzeug itsdan ...

  5. Linux 用top命令查看CPU和内存使用情况

    直接 top 回车 PID:进程的ID USER:进程所有者 PR:进程的优先级别,越小越优先被执行 NInice:值 VIRT:进程占用的虚拟内存 RES:进程占用的物理内存 SHR:进程使用的共享 ...

  6. Java面试经典题目合集

    32 1.”static”关键字是什么意思?Java中是否可以覆盖(override)一个private或者是static的方法? “static”关键字表明一个成员变量或者是成员方法与类相关,可以在 ...

  7. 【六】Hystrix Dashboard

    除了隔离依赖服务的调用以外,Hystrix还提供了准实时的调用监控(Hystrix Dashboard) , Hystrix会持续地记录所有通过 Hystrix发起的请求的执行信息,并以统计报表和图形 ...

  8. sqlserver 备份脚本

    BACKUP DATABASE 数据库名称  TO DISK='d:\3333.bak' ---根据时间生成文件名 --将SQL脚本赋值给变量declare @SqlBackupDataBase as ...

  9. linux 删除占用文件

    清空 程序占用日志文件: cat /dev/null > log 或: echo " " > log 直接删除程序占用文件大小不生效: rm -rf log ps -e ...

  10. Nmap扫描基础常用命令(包含进阶使用)

    Nmap扫描常用命令  - Nmap scans common commands 1.扫描单个目标 nmap ip 如:nmap 192.168.0.101 2.扫描多个目标 nmap ip1 ip2 ...