1

I am writing a timer job in the proposed way using a feature receiver to install the timer job.

In my development environment, things are working well, its stand alone.

When I deploy to test environment however, there are 2 WFE servers in the farm. This is where things get dicey.

At first I set the SPJobLockType to Job = SPJobLockType.Job.

I ran StsAdmin from the WFE I wanted the job to run on, This is also the WFE hosting central administration. I activated the feature using stsadm, because regular GUI functionality wouldn't work.

The job definition ends up in the list of available jobs, but when I run it, the job fails, and the server field in job history states WFE2, and not the one I ran the job from.

Next I decided to manually specify the SPServer in the job constructor.

Previously had:

public MyJobCode(string jobName, SPWebApplication webApplication)
            : base(jobName, webApplication, null, SPJobLockType.Job)

Changed this to:

public MyJobCode(string jobName, SPWebApplication webApplication)
            : base(jobName, webApplication, SPServer.Local, SPJobLockType.Job)

This time the job doesn't fail, but instead, nothing happens, job does run, neither does the job even show that it has been queued, or running or scheduled. Nothing, zip!

Basically what I want is the job to run from WFE1, without failing.

How is this done?

2 Answers 2

3

I decided to activate the timer job feature in central admin.

I didn't know but central admin is after all just another sharepoint site, that has a site settings menu, and you can house features in it.

3
  • What was the scope of your Feature? If it was Farm or Web Application, you should've been able to activate it under Farm Features or Web Application Features. It sounds to me you had the Feature scoped to Site Collection.
    – James Love
    Jun 9, 2011 at 7:04
  • Isn't this the answer to the question - he didn't activate the feature so the timer job never was actually registered. Jun 9, 2011 at 7:36
  • @Wictor Only the OP can mark a question answered. The best we can do is upvote it.
    – Alex Angas
    Jun 9, 2011 at 7:58
0

Perhaps posting the code (snippets) of your timer job might have helped. ;-) What I would suggest is to indeed use the JOB type as it seems you only want to run it on one server. Does it matter on which server it runs? Secondly I would suggest to debug the timer job from VS2010. Attach to OWSTimer process and you should be able to intercept upon feature activation. Make sure you remove older definitions in code as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.