Debugging Sharepoint timer jobs

倖福魔咒の 提交于 2019-12-03 07:45:18

When I'm debugging TimerJobs I insert a Assertion at the very first begin of the Execute method, which will always fail. This results in a pop up every time the Execute method is called so you can be sure that the TimerJob was started and have enough time to attach the debugger. Of course you have to remove the Assertion before you go live.

System.Diagnostics.Trace.Assert(false);

One more important thing is that you restart the Timer Service after you deployed a new DLL. Otherwise the Timer Service will run the TimerJob from the old DLL.

Most common reasons:

  1. Did you do a debug build?
  2. Did you place the .pdb file in the same folder as the assembly? (A simple search should explain how - eg. Debugging Timer Jobs)
  3. Also read Debugging Custom Timer Jobs on MSDN for some tips.
  4. Perform the 3 R's: Re-build & Re-deploy assembly & Reset the Timer Service before trying to attach again.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!