Andrew Connell on 2008-10-13
How to debug custom timer jobs in WSS.
This link has been bookmarked by 11 people . It was first bookmarked on 16 May 2008, by Marshall S.
Inevitably at some phase during the development of an application, you must
debug your custom code to isolate and troubleshoot a defect or to monitor the
state of the application. Thankfully, you can debug timer jobs by using Visual
Studio just as you would any other managed application. However, it is not as
easy as pressing F5 or manually attaching to the W3WP.exe process that hosts
application pools. Timer jobs are executed by a special Windows service that is
set up on the server when you install Windows SharePoint Services: the Windows
SharePoint Services Timer. This service triggers the executable Owstimer.exe.
You must attach to this process to debug custom timer jobs.
It can be challenging at times to determine whether the application has
attached to the process because the jobs may not fire for a few minutes at a
time. You could be left with Visual Studio attached to the Owstimer.exe process
with breakpoints set, not knowing if the job is running or if the breakpoints
are not being hit because of an issue with loading the symbol (*.pdb) files. An
easy way to determine whether the timer job is running is to add a single line
of code into the SPJobDefinition.Execute method that displays a
messagebox on the server and blocks execution of the timer job until you close
the message box.
By adding the following code to the Execute method, you not only see
your timer jobs running (as shown in Figure 3), but you also have time to
manually attach the Visual Studio debugger to the Owstimer.exe process. After
attaching the debugger to the process, click Ignore in the message box to
enable the timer job to continue to run.
Andrew Connell on 2008-10-13
How to debug custom timer jobs in WSS.
Learn about building, deploying, and debugging custom timer jobs in Windows SharePoint Services 3.0, and examine the various configuration options that are available to developers.
Public Stiky Notes
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.