惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
V
V2EX
雷峰网
雷峰网
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
F
Full Disclosure
Y
Y Combinator Blog
V
V2EX - 技术
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
SecWiki News
SecWiki News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
量子位
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
K
Kaspersky official blog
B
Blog
A
Arctic Wolf
Hacker News: Ask HN
Hacker News: Ask HN
L
LangChain Blog
T
Tor Project blog
P
Privacy & Cybersecurity Law Blog
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
Lohrmann on Cybersecurity
D
Docker
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
The Last Watchdog
The Last Watchdog
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy International News Feed
Simon Willison's Weblog
Simon Willison's Weblog

博客园 - LeeWenjie

【转发】NPAPI学习(Firefox和Chrome扩展开发 ) 【转发】NPAPI开发详解,Windows版 【转发】网易邮箱前端技术分享之javascript编码规范 【转发】揭秘Facebook 的系统架构 【转发】淘宝网架构分享总结 【转发】淘宝网采用什么技术架构来实现网站高负载的 【转发】浅析淘宝网首页信息架构的变迁 【转发】Html5 File Upload with Progress 【转载】使用JavaScript实现Motion Detection 【转发】WEB前端开发规范文档 【转发】响应式Web设计?怎样进行? 【转发】开源中最好的Web开发的资源 【原创】PDA DataGrid的滚动条事件处理 【原创】PDA 实现DataGrid可编辑 【转发】SharePoint 2010——ListData.svc故障排除 【转发】谈论 SharePoint 2010中的沙盒解决方案(Sandboxed Solution) 【原创】NET4.0在SharePoint 2010 IIS下出现导演 C#实现多语言 【转载】互联网产品开发中的“快”字诀
【转载】SHAREPOINT TimeJob定时器开发
LeeWenjie · 2011-11-30 · via 博客园 - LeeWenjie

Technorati 标签: TimeJob,定时器,sharepoint,moss

SHAREPOINT定时器开发其实比较简单,只是资料相对较少,我认为开发者只要参考这三篇文档既可。

第一篇:中文的资料,可以大致熟悉下思路和方法,但是其中的一些内容可能不是最新的了

http://www.cnblogs.com/zhalin/archive/2008/03/07/1094385.html

第二篇:AC最新写的HOW TO文章,非常详尽

http://msdn.microsoft.com/en-us/library/cc406686.aspx#WSSCustomTimerJobs_Conclusion

第三篇:第二篇的代码下载

http://code.msdn.microsoft.com/SharePointWarmupJob/Release/ProjectReleases.aspx?ReleaseId=1117

下面重新再总结下定时器的开发、部署与调试方法:

1 定时器开发

1)框架就照搬上面的源代码,要用VS2008开发

2)重新引用Microsoft.SharePoint.ApplicationPages.Administration 位置在:C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\ADMINBIN\Microsoft.SharePoint.ApplicationPages.Administration.dll

3)在Execute方法中编写自定义代码

4) 如果需要获取外部的配置信息,需要写一个OwsTimer.exe.config ,放到C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN 中

OwsTimer.exe.config文件实例:

<configuration>
  <appSettings>
   <add key="CBSS" value="server=;database=;user id=;password=" />
  </appSettings>
</configuration>

5)编译后,自动会生成WSP

2 部署

1)用VS命令行方式注册MSDN.SharePoint.Samples.SharePointWarmupJob.dll到GAC

cls
d:
cd D:\mossproject\test\SharePointWarmupJob.Source\SharePointWarmupJob
"d:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf MSDN.SharePoint.Samples.SharePointWarmupJob
"d:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if bin\Debug\MSDN.SharePoint.Samples.SharePointWarmupJob.dll

iisreset

2)部署WarmUpJobManager.aspx

原来定时器需要另外一个SPFeatureReceiver类,因为我们需要一个Feature来把我们的Timer部署到服务器上去,通过Feature Activated/deactivated来触发/关闭这个TimerJob,TIMEJOB的间隔时间也在这里设置。

现在有了WarmUpJobManager.aspx就无需这么麻烦了。WarmUpJobManager.aspx在源代码中已经包含了,需要把TEMPLATE下的ADMIN文件夹整个拷贝到C:\Program Files\Common Files\Microsoft Shared\web server extensions\12中

在安装完solution 后就可以在应用程序管理中看到

image

3)安装solution

pushd %programfiles%\common files\microsoft shared\web server extensions\12\bin

stsadm -o addsolution -filename D:\mossproject\test\SharePointWarmupJob.Source\SharePointWarmupJob\wsp\Debug\SharePointWarmupJob.wsp

stsadm -o deploysolution -name SharePointWarmupJob.wsp -local -force –allowGacDeployment

4)触发/关闭这个TimerJob

image

5)重启TIMEJOB

net stop SPTimerV3
net start SPTimerV3

3 调试

1)确保代码是以DEBUG方式编译

2)Execute方法中编写的自定义代码头尾要加上

#if (DEBUG)

      GetOwsTimerTask();

#endif

3)每次都必需按照以下顺序操作才能正常调试

  • 把Assembly DLL放到 GAC
  • 命令行:iisreset
  • 在WarmUpJobManager.aspx中Deactivate feature, 然后activate feature.
  • 命令行:net stop SPTimerV3
  • 命令行:net start SPTimerV3
  • Visual Studio: Attach to process: OWSTIMER.EXE
  • 完。