Sharepoint Timer Job - Which server does the job execute on?
If I install a (timer job) feature to a Sharepoint front end server within a farm, which server executes the job? All of them?
The job is locked at the job level, and the Execute method calls a web service on one specific machine on the farm, which handles all the processing. My question is whether all the 开发者_StackOverflow中文版front end servers will try and run this job?
Or network guys want to provide a new server in the farm, so that this job doesn't eat up the resources of the main server, but it sounds to me like we will duplicate the execution of the job.
Confused. Anyone know the answer to this question?
The timer job can actually be deployed to a single instance (or to all of them if you like). This link provides a good answer:
Timer Job deployment via constructors
For SharePoint 2010, see How to: Run Code on All Web Servers:
MyTimerJob myTJ = new MyTimerJob(
"contoso-job-add-mobile-adapter",
webApp,
null,
SPJobLockType.None);
Note the following about this code:
The third parameter can be used to specify a particular server on which the job should run. This is null when the job should run on all front-end Web servers.
The fourth parameter determines whether the job executes on all front-end Web servers. Passing SPJobLockType.None ensures that it runs on all servers on which the Microsoft SharePoint Foundation Web Application service is running. By contrast, passing SPJobLockType.Job ensures that it runs only on the first available server on which the Microsoft SharePoint Foundation Web Application service is running. (There is a third possible value. For more information, see SPJobDefinition and the topics for its constructors and other members.)
精彩评论