I have successfully created the custom timer job to send status mails on daily basis. For testing I set the minute scheduler on the job and deployed as Web Application Scope.

The timer job is running fine, but it is running for all the Web Application on the SharePoint server Farm.

I want it to run on specific web application. Please help.

2 Answers 2


Timer Jobs are usually deployed in All Web Application but the actual business logic can be limit to a single web application. This can be accomplished by using a Feature receiver within your timer job. Having the timer job in your web application doesn't mean that your timer job is actually already there so you still need to have a feature receiver in able for your timer job to be attach in a specific web application/s.

In the Feature event receiver you just need to have a code snippets that creates an instance of timer job and then attach to your web application.

for more info you can look at the "Deploying Your Timer Job


  • In the above reference the code snippet for retrieving web application in event receiver is SPWebApplication webApplication = (SPWebApplication)properties.Feature.Parent So, I think the parent should be the web-application for which I have given test site url in my initial project configuration. What I am not understanding is that, how the timer job is getting attached to other web-applications ? May 30, 2013 at 13:24
  • 1
    Hi, is it evident the the timer job really is attached to the web application? as far as i understand you are doing the deployment of the timer job like what is discuss in the article i provided. So what might be the reason is because the feature of your timer job is activated in the other web application. There is a Manage Features in web application level right? So every time this feature is activated in web application the timer job is attached. So make sure that this feature is just activated in the web application that you want. May 31, 2013 at 4:52
  • 1
    BTW, to remove the timer job from the other web application make sure you have a receiving on FeatureDeactivating of your feature receiver to clear the timer job in the web application that you decided to deactivate. Deactivating event is also discuss in the link above. May 31, 2013 at 4:54

The answer lies in the constructor where you would need to pass the Web Application under which to run. Finally it will get down to activating the Feature deploying the custom time job, only for the proper web application (scope of the Feature should be anyways WebApplication).

public override void Execute(Guid targetInstanceId)
  // Execute the timer job logic.
  SPWebApplication webApp = this.Parent as SPWebApplication;

http://msdn.microsoft.com/en-us/library/ff798313.aspx and http://msdn.microsoft.com/en-us/library/hh528518(v=office.14).aspx

  • I have referred the links while creating timer job. And I have tried with SPWebApplication spweb = this.WebApplication and SPWebApplication spweb = this.Parent as SPWebApplication but still whenever I deploy the solution , the timer job is created for all the web application. Is it anyway related to the site url property while creating project or permissions or in FeatureActivated Event receiver? May 30, 2013 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.