Showing posts with label and Debugging Custom Timer Jobs in Windows SharePoint. Show all posts
Showing posts with label and Debugging Custom Timer Jobs in Windows SharePoint. Show all posts

Friday, November 18, 2011

Creating, Deploying, and Debugging Custom Timer Jobs in Windows SharePoint

Windows SharePoint Services 3.0 lets you create custom jobs that are executed at set intervals. These jobs, known as timer jobs, are similar to those tasks that you can create in any version of Windows by using the Task Scheduler application. This capability is useful for scheduled process jobs because you keep everything in Windows SharePoint Services rather than create a console .exe file that is configured to run at set intervals by using the Windows Task Scheduler. The major benefits to using the Windows SharePoint Services timer service compared to using Windows Task Scheduler is that the timer service knows the topology of the Office SharePoint Server farm, and that you can load balance the jobs across all the servers in the farm or tie them to specific servers that are running particular services. This Microsoft Office Visual How To demonstrates how to create a job that requests the home page of each site collection in a Web application to force just-in-time (JIT) compilation and to speed up the first request.

public SharePointWarmupJob (SPWebApplication webApp)
  : base(JOB_NAME, webApp, null, SPJobLockType.ContentDatabase) {
    this.Title = JOB_NAME;
}
public override void Execute (Guid targetInstanceId) {
  if (this.WebApplication.Sites.Count > 0)
    WarmUpSiteCollection(this.WebApplication.Sites[0]);
}
private void WarmUpSiteCollection (SPSite siteCollecion) {
  WebRequest request = WebRequest.Create(siteCollecion.Url);
  request.Credentials = CredentialCache.DefaultCredentials;
  request.Method = "GET";
  WebResponse response = request.GetResponse();
  response.Close();
}

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...