Debug a Sharepoint Timer Job

http://msdn.microsoft.com/en-us/library/ff798310.aspx

When you create a timer job for Microsoft® SharePoint® 2010, you cannot directly press F5 to debug your code. Instead, you must attach the debugger to the SharePoint 2010 Timer process (Owstimer.exe). This how-to topic describes how to debug a timer job by attaching the Visual Studio debugger to the timer process.

Timer Job Process – OwsTimer.exe

Before debugging, make sure Timer Job
is started (check in Service).

Open VS 2010, open your Timer Job project, make sure your code is not changed since last deployment, otherwise the debugger will not match your source code.

Set a breakpoint to the code inside your Execute Method, such as this:

Go to Debug à Attached to Process, in the Application Process window, select OWSTimer.EXE

In Central Admin à Monitoring à Timer Jobs, go to your job, and Run Now. Your VS 2010 shold stop at your breakpoint.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: