Tho*_*res 0 breakpoints timer-jobs sharepoint-2010
我有一点问题.我正在尝试按照本教程添加计时器作业:http://dotnetfinder.wordpress.com/2010/07/24/creatingcustomsharepointtimerjob2010/
我到了启用计时器作业并且每五分钟启动一次的程度.问题是它没有执行所有的Execute方法.
public override void Execute(Guid contentDbId)
{
// get a reference to the current site collection's content database
SPWebApplication webApplication = this.Parent as SPWebApplication;
SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
// get a reference to the "ListTimerJob" list in the RootWeb of the first site collection in the content database
SPList Listjob = contentDb.Sites[0].RootWeb.Lists["Liens"];
// create a new list Item, set the Title to the current day/time, and update the item
SPListItem newList = Listjob.Items.Add();
//newList["URL"] = "http://"+DateTime.Now.ToString()+".fr";
//newList.Update();
}
Run Code Online (Sandbox Code Playgroud)
我将调试器附加到OWSTIMER.EXE.如果我尝试在该行添加一个断点:SPList ListJob = ...,没关系,但如果我尝试在下一行添加一个新的断点(SPListItem newList = ...),那么我有以下消息:"无法设置以下断点:... CLR无法设置断点".
有谁知道我怎么能让它发挥作用?
您似乎正在附加到正确的服务.请参见如何:调试计时器作业以仔细检查您的步骤.
此外,正如此注释中所指出的,您应该在部署计时器作业时重新启动计时器服务:
标记
2011年2月11日凌晨4:41
任何Timer项目都需要完成一个非常重要的步骤.您需要在部署之间回收SharPoint计时器服务.最好的方法是添加
net stop SPTimerV4 - Pre Build
net start SPTimerV4 - Post Build
到您的sharepoint项目.如果你不这样做 - 你会很困惑为什么你的代码似乎不是最新的.原因是计时器服务使用您的类缓存程序集.在尝试确定代码未部署的原因时,这可能会花费您数小时的故障排除.
| 归档时间: |
|
| 查看次数: |
4562 次 |
| 最近记录: |