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…
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 2016Then in the Attach Security Warning click on Attach button.
You may get the below message, just wait for the message box to go.
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:
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:
Then the debugger point will hit and you can debug the timer job.
Hope this will be helpful.
-: FREE PDF e-Book Download :-
51 JSOM Examples in SharePoint Online
You May Also like the Following SharePoint Online Tutorials: