Timer jobs are an effective means to handle a situation where a process needs to run periodically. E.g. Periodically checking if an item has expired and emailing users to notify of that expiry. However when developing a timer job the process to debug it is not as straightforward as a traditional application.

The following steps describe how to debug a timer job using Visual Studio. (In this case with SharePoint 2010, Visual Studio 2013 and Windows Server 2012).

1. First deploy your solution containing your timer job to SharePoint. From Visual Studio click Build and then Deploy Solution

2. Open Windows Services. Click the Start button and type Services, alternatively this can be accessed from Control Panel > System and Security > Administrative Tools.

3. Select the service named SharePoint 2010 Timer this ensures the latest .DLL is loaded for your timer job.

4. From Visual Studio attach the debugger to the process named OWSTIMER.EXE. To do so select Debug and Attach to Process. You may need to tick the check box Show processes from all users to find OWSTIMER.EXE.

5. Next open Central Administration. Click on Monitoring and then select Review job definitions. This will list all Timer Jobs, select your timer job and click Run Now

Your timer job will now execute and will hit any breakpoints you have set within Visual Studio. For more information see our bespoke software development page.

Get Up To Speed With SharePoint 2019!

Download Our FREE eBook...

 

Download SharePoint 2019 eBook

Comments