昨天被TimerJob困擾了一天。緣由就是TimerJob當中會有一個Httpwebrequest GET請求一個Application Page進行一些操做(其中有一個操做是發送郵件)。可是發現隨機性的Httpwebrequest會重複請求Application Page。起初覺得是SMTP的問題,排除不是!Httpwebrequest重複發送,排除不是!只多是TimerJob執行了兩次,結果問題就出在TimerJob SPJobLockType屬性。web
SPJobLockType 枚舉 (Microsoft.SharePoint.Administration)it
Values for the lock type of a job definition.
命名空間: Microsoft.SharePoint.Administration
程序集: Microsoft.SharePoint (在 microsoft.sharepoint.dll 中)io
成員名稱 | 說明 | |
---|---|---|
ContentDatabase | Locks the content database before processing. | |
Job | Locks the job to prevent it from running on more than one machine. | |
None | No locks |
若是出現TimerJob重複的狀況,能夠試下修改SPJobLockType屬性值。event