Monday 8 September 2014

Fix SharePoint Timer Jobs Running Multiple Times OR ( timer job executing twice )

 

 http://blog.mohnady.com/2012/07/fix-sharepoint-timer-jobs-running.html

 

publicoverride void Execute(Guid targetInstanceId)

{
  
SPWebApplication
webApplication = this.Parent as SPWebApplication;

SPWeb web = webApplication.Sites[0].RootWeb;
if (web.Site.ContentDatabase.Id.Equals(targetInstanceId))

{
// your Logic Here
}

     
}

----------- OR  --------

- In your Timer job constructor you will find one of the parameters is SPJobLockType Enumeration


- You should replace it with :  SPJobLockType.job





- SPJobLockType.ContentDatabase : Timer job runs one time for each content database associated with the Web application.

- SPJobLockType.job : Runs only on one machine in the farm.


http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spjoblocktype.aspx



naadydev@gmail.com

No comments:

Post a Comment