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.
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?