How to debug timer job in SharePoint 2016 using Visual Studio 2015?

visual studio 2015 debug timer job sharepoint 2016

Here we will discuss how to debug timer job in SharePoint 2016 using visual studio 2015. Debugging a timer job is different from normal solution. You can check below article to know how to create a timer job using visual studio 2015 in SharePoint 2016.

To debug timer job open visual studio 2015 timer job solution. Click on Debug -> Attach to Process…

visual studio 2015 debug timer job sharepoint 2013
visual studio 2015 debug timer job sharepoint 2013

Then in the Attach to Process select “OWSTIMER.EXE” and click on Attach. If you did not see the OWSTIMER.EXE process then you can check “Show processes from users” checkbox.

steps to debug timer job in visual studio 2015 SharePoint 2016

steps to debug timer job in visual studio 2015 SharePoint 2016Then in the Attach Security Warning click on Attach button.

timer job debugging sharepoint 2013 visual studio 2015
timer job debugging sharepoint 2013 visual studio 2015

Also, read:

Display data in a tabular format using JavaScript client object model in SharePoint Online

You may get the below message, just wait for the message box to go.

debug timer job in SharePoint 2016
debug timer job in SharePoint 2016

You can give breakpoint in the Execute method in the Timerjob class. When the timer job scheduled time occurs it will hit the breakpoint. If the breakpoint did not hit then you can restart the timer job service.

For this click on Window + R, then type services.msc. It will open the Services screen. There search for SharePoint Timer Service and click on Restart the service like below:

debug timer job in SharePoint 2013
debug timer job in SharePoint 2013

You can also run the timer job immediatly by running the job now.

Open SharePoint central administration, then click on Monitoring and then click on Review job definitions. Then click on the particular timer job and then when the Edit Timer job page will open click on Run Now button like below:

visual studio 2015 debug timer job sharepoint 2016
visual studio 2015 debug timer job sharepoint 2016

Then the debugger point will hit and you can debug the timer job.

Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →