TimerJob无法发布新版本问题
最近遭遇发布TimerJob在测试环境发布没有问题,但是到正式环境发布总是无法执行及调试的问题,经过几天的努力,终于解决了这个问题,下面记录下遭遇的问题。
Windows 2008,SharePoint 2013,测试环境为单机,生产环境为双AP,一DB。双AP中一个是AP+管理中心,另外一个只做索引爬网。
测试环境一切正常,可以执行调试,部署至于正式环境会碰到:错误 2 部署步骤“激活功能”中出现错误: Feature with Id 'xx' is not installed in this farm, and cannot be added to this scope.该错误正常,去管理中心部署解决方案至site即可。
下面问题来了,解决方案中有两个Feature,一个是包含了可视化的WebPart的,另外一个是激活后新建TimerJob的。TimerJob这个无法执行无法调试。
1、更改了TimerJob的名称,但是依旧在重新激活Feature后显示旧的TimerJob名称。
2、移除C:\Windows\Microsoft.NET\assembly\GAC_MSIL中相应的dll,依旧无法执行调试。
3、移除网站目录下bin目录的dll,依旧没解决。
4、整个盘搜索相关dll,全部删除,依旧没有解决。
5、。。。
以上皆重启多次IIS及Timer Service。
后终于想明白,这可能是Timer Job的缓存导致的,google搜索"sharepoint timerjob cache",果然发现:,https://nickhobbs.wordpress.com/2012/06/14/sharepoint-2010-powershell-to-clear-the-timer-job-cache:
- Stop Windows SharePoint Timer Service from Windows Services
- Open C:\ProgramData\Microsoft\SharePoint\Config\<<GUID>> folder
- Delete all the XML files inside the GUID folder.
- Open the Cache.ini file and change the value to 1.
- Save Cache.ini file
- Restart Windows SharePoint Timer Service from Windows Services
注意需要在每个APP上执行一次。
我的操作:先收回解决方案,再执行以上操作,再部署,激活,问题解决。
作者还做了个脚本:
# Clear the SharePoint Timer Cache
#
# 2009 Mickey Kamp Parbst Jervin (mickeyjervin.wordpress.com)
# 2011 Adapted by Nick Hobbs (nickhobbs.wordpress.com) to work with SharePoint 2010,
# display more progress information, restart all timer services in the farm,
# and make reusable functions. # Output program information
Write-Host -foregroundcolor White ""
Write-Host -foregroundcolor White "Clear SharePoint Timer Cache" #**************************************************************************************
# References
#**************************************************************************************
[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
[void][reflection.assembly]::LoadWithPartialName("System")
[void][reflection.assembly]::LoadWithPartialName("System.Collections")
#************************************************************************************** #**************************************************************************************
# Constants
#**************************************************************************************
Set-Variable timerServiceName -option Constant -value "SharePoint 2010 Timer"
Set-Variable timerServiceInstanceName -option Constant -value "Microsoft SharePoint Foundation Timer" #**************************************************************************************
# Functions
#************************************************************************************** #<summary>
# Stops the SharePoint Timer Service on each server in the SharePoint Farm.
#</summary>
#<param name="$farm">The SharePoint farm object.</param>
function StopSharePointTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)
{
Write-Host "" # Iterate through each server in the farm, and each service in each server
foreach($server in $farm.Servers)
{
foreach($instance in $server.ServiceInstances)
{
# If the server has the timer service then stop the service
if($instance.TypeName -eq $timerServiceInstanceName)
{
[string]$serverName = $server.Name Write-Host -foregroundcolor DarkGray -NoNewline "Stop '$timerServiceName' service on server: "
Write-Host -foregroundcolor Gray $serverName $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"
$serviceInternalName = $service.Name
sc.exe \\$serverName stop $serviceInternalName > $null # Wait until this service has actually stopped
WaitForServiceState $serverName $timerServiceName "Stopped" break;
}
}
} Write-Host ""
} #<summary>
# Waits for the service on the server to reach the required service state.
# This can be used to wait for the "SharePoint 2010 Timer" service to stop or to start
#</summary>
#<param name="$serverName">The name of the server with the service to monitor.</param>
#<param name="$serviceName">The name of the service to monitor.</param>
#<param name="$serviceState">The service state to wait for, e.g. Stopped, or Running.</param>
function WaitForServiceState([string]$serverName, [string]$serviceName, [string]$serviceState)
{
Write-Host -foregroundcolor DarkGray -NoNewLine "Waiting for service '$serviceName' to change state to $serviceState on server $serverName" do
{
Start-Sleep 1
Write-Host -foregroundcolor DarkGray -NoNewLine "."
$service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$serviceName'"
}
while ($service.State -ne $serviceState) Write-Host -foregroundcolor DarkGray -NoNewLine " Service is "
Write-Host -foregroundcolor Gray $serviceState
} #<summary>
# Starts the SharePoint Timer Service on each server in the SharePoint Farm.
#</summary>
#<param name="$farm">The SharePoint farm object.</param>
function StartSharePointTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)
{
Write-Host "" # Iterate through each server in the farm, and each service in each server
foreach($server in $farm.Servers)
{
foreach($instance in $server.ServiceInstances)
{
# If the server has the timer service then start the service
if($instance.TypeName -eq $timerServiceInstanceName)
{
[string]$serverName = $server.Name Write-Host -foregroundcolor DarkGray -NoNewline "Start '$timerServiceName' service on server: "
Write-Host -foregroundcolor Gray $serverName $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"
[string]$serviceInternalName = $service.Name
sc.exe \\$serverName start $serviceInternalName > $null WaitForServiceState $serverName $timerServiceName "Running" break;
}
}
} Write-Host ""
} #<summary>
# Removes all xml files recursive on an UNC path
#</summary>
#<param name="$farm">The SharePoint farm object.</param>
function DeleteXmlFilesFromConfigCache([Microsoft.SharePoint.Administration.SPFarm]$farm)
{
Write-Host ""
Write-Host -foregroundcolor DarkGray "Delete xml files" [string] $path = "" # Iterate through each server in the farm, and each service in each server
foreach($server in $farm.Servers)
{
foreach($instance in $server.ServiceInstances)
{
# If the server has the timer service delete the XML files from the config cache
if($instance.TypeName -eq $timerServiceInstanceName)
{
[string]$serverName = $server.Name Write-Host -foregroundcolor DarkGray -NoNewline "Deleting xml files from config cache on server: "
Write-Host -foregroundcolor Gray $serverName # Remove all xml files recursive on an UNC path
$path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\*.xml"
Remove-Item -path $path -Force break
}
}
} Write-Host ""
} #<summary>
# Clears the SharePoint cache on an UNC path
#</summary>
#<param name="$farm">The SharePoint farm object.</param>
function ClearTimerCache([Microsoft.SharePoint.Administration.SPFarm]$farm)
{
Write-Host ""
Write-Host -foregroundcolor DarkGray "Clear the cache" [string] $path = "" # Iterate through each server in the farm, and each service in each server
foreach($server in $farm.Servers)
{
foreach($instance in $server.ServiceInstances)
{
# If the server has the timer service then force the cache settings to be refreshed
if($instance.TypeName -eq $timerServiceInstanceName)
{
[string]$serverName = $server.Name Write-Host -foregroundcolor DarkGray -NoNewline "Clearing timer cache on server: "
Write-Host -foregroundcolor Gray $serverName # Clear the cache on an UNC path
# 1 = refresh all cache settings
$path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\cache.ini"
Set-Content -path $path -Value "" break
}
}
} Write-Host ""
} #**************************************************************************************
# Main script block
#************************************************************************************** # Get the local farm instance
[Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local() # Stop the SharePoint Timer Service on each server in the farm
StopSharePointTimerServicesInFarm $farm # Delete all xml files from cache config folder on each server in the farm
DeleteXmlFilesFromConfigCache $farm # Clear the timer cache on each server in the farm
ClearTimerCache $farm # Start the SharePoint Timer Service on each server in the farm
StartSharePointTimerServicesInFarm $farm
TimerJob无法发布新版本问题的更多相关文章
- 发布新版本遇见java.lang.ClassNotFoundException
今天发布新版本到测试环境,服务器在启动时报了java.lang.ClassNotFoundException .刚开始我以为是代码中jar引的不对从而导致找不到相关类,后来在本地试了下发现项目可以正常 ...
- 快如闪电,触控优先。新一代的纯前端控件集 WijmoJS发布新版本了
全球最大的控件提供商葡萄城宣布,新一代纯前端控件 WijmoJS 发布2018 v1 版本,进一步增强产品功能,并支持在 Npm 上的安装和发布,极大的提升了产品的易用性. WijmoJS 是用 Ty ...
- 【开源】开发者新闻聚合APP 1.0.3发布(第一个稳定版本,短期内不再发布新版本)
聚合了博客园新闻.infoq新闻.36kr新闻.oschina新闻.51cto新闻.csdn新闻: 争取做到随时刷随时有开发者的新闻! 目前还只支持安卓APP 最新版本的下载地址:https://gi ...
- 微信小程序发布新版本时自动提示用户更新
如图,当小程序发布新的版本后,用户如果之前访问过该小程序,通过已打开的小程序进入(未手动删除),则会弹出这个提示,提醒用户更新新的版本.用户点击确定就可以自动重启更新,点击取消则关闭弹窗,不再更新. ...
- 关于微信小程序发布新版本后的提示用户更新的方法详解
当小程序发布新的版本后 ,用户如果之前访问过该小程序,通过已打开的小程序进入(未手动删除),则会检测新版本,提醒用户更新新的版本 话不多说,上代码 App({ onLaunch: function ( ...
- .Net/.Net Core 的界面框架 NanUI 发布新版本啦!
发布前感悟 NanUI 自从上一次更新 NanUI 0.7 已经过去大半年,B站和头条的教学视频也只制作到了第二集. 有朋友悄悄问我是不是发生什么事故我删库跑路了所以那么长时间不更新项目不发布教程,当 ...
- Stimulsoft Reports和Dashboards发布新版本2020.5具有多项改进
Stimulsoft仪表工具实现所需的数据可视化和自己的信息图表.该产品能够应用必要的过滤器和排序,汇总数据,执行任何复杂度的计算.该产品的优势在于其多功能性-能够为您的业务,财务,销售,行业等任何领 ...
- Android热修复技术选型(不在市场发布新版本的情况下,直接更新app)
2015年以来,Android开发领域里对热修复技术的讨论和分享越来越多,同时也出现了一些不同的解决方案,如QQ空间补丁方案.阿里AndFix以及微信Tinker,它们在原理各有不同,适用场景各异,到 ...
- 🙀Java 又双叒叕发布新版本,这么多版本如何灵活管理?
文章来源:http://1t.click/bjAG 前言 不知不觉 JDK13 发布已有两个月,不知道各位有没有下载学习体验一番?每次下载安装之后,需要重新配置一下 Java 环境变量.等到运行平时的 ...
随机推荐
- Javascript设计模式理论与实战:适配器模式
有的时候在开发过程中,我们会发现,客户端需要的接口和提供的接口发生不兼容的问题.由于特殊的原因我们无法修改客户端接口.在这种情况下,我们需要适配现有接口和不兼容的类,这就要提到适配器模式.通过适配器, ...
- Android实现表单提交,webapi接收
1.服务端采用的是.net的WEBAPI接口. 2.android多文件上传. 以下为核心代码: package com.example.my.androidupload; import androi ...
- roadflow asp.net工作流自定义表单
在roadflow表单设计器不能满足很复杂的业务需求的时候,可以采用自定义表单(即表单页面自己做). 自定义表单就是自己写一个页面,包含控制器视图,然后将这个页面挂到流程上进行审批. 自定义表单分为以 ...
- 开发者常用的十款Chrome插件
本文是稀土掘金投稿,虽然其中有倔金的私货,是篇推广文,但我看过后认为内容确实不错,有些好插件还是第一次知道,对我很有帮助,考虑过后还是决定推荐给大家,最近我比较关注各种提高开发效率的工具与技巧,今后看 ...
- 【bzoj4998】星球联盟(并查集+边双)
题面 传送门 题解 总算有自己的\(bzoj\)账号啦! 话说这题好像\(Scape\)去年暑假就讲过--然而我到现在才会-- \(LCT\)什么的跑得太慢了而且我也不会,所以这里是一个并查集的做法 ...
- Spring-解决请求中文乱码问题
解决spring请求中文乱码问题 1.web.xml添加编码拦截器 <filter> <filter-name>CharacterEncoding</filter-nam ...
- windows环境下ElasticSearch5以上版本安装head插件
我的ElasticSearch版本是5以上的,网上搜了好多安装方式,都不对. 还好找到一个成功的,转载过来做记录. 原文地址:ElasticSearch-5.0安装head插件 步骤 下载node.j ...
- iOS几个功能:1.摇一摇;2.震动;3.简单的摇动动画;4.生成二维码图片;5.发送短信;6.播放网络音频等
有一个开锁的功能,具体的需求就类似于微信的“摇一摇”功能:摇动手机,手机震动,手机上的锁的图片摇动一下,然后发送开锁指令.需求简单,但用到了许多方面的知识. 1.摇一摇 相对这是最简单的功能了. 在v ...
- Linux之Ubuntu切换root su -
当在Ubuntu系统从普通用户切换到root用户时,总是会报错,提示错误信息.这时因为我们还没有给系统中的root用户设置密码,我们给Ubuntu系统中的root用户设置一个密码就可以实现普通用户和管 ...
- mybatis的mapper.xml使用parameterType使用的报错
错误在于一个写的get(Long id)的查询方法, 而在Mapper.xml中我定义了这个接收的参数的类型是int类型, 结果就报了如下的错误 org.mybatis.spring.MyBatisS ...