Last week I was developing a custom TimerJob for SharePoint. For the development of the TimerJob I used the MSDN documentation that is written by Andrew Connell:
This article really points out everything when you are developing your first TimerJob. I followed the article and I almost read all the code sections so that I knew what to do and added my personal code so that the feature did what I wanted.
The only thing that I had changed was the scope of the feature because I wanted a WebApplication scoped feature. When I deployed the feature and activated it trough the GUI the feature added the TimerJob to SharePoint. The TimerJob also started but it stayed on the status Initialized with 0% complete.
I found this really strange. Because I read the article from Andrew Connell real quick I went back and read it again. I know many developers and most of the time everything has to be done quickly and they forget to read the whole article (just like me) that’s why I wrote this post to point out a section of the article. Because I could not find a solution with Google because Andrew Connell just points it out in the article.
“The Feature that handles the installation and uninstallation of a timer job should be a hidden Feature so that activation is only possible by using Stsadm.exe through the console. This is because when Features are activated through the Web interface, the application pool’s identity is used to execute the code in the Feature receiver. This account typically does not have permissions to install the timer job. Instead, use an account that is part of the farm administrators group to activate the Feature using Stsadm.exe.”