Implementing scheduled services in Sitefinity 3.x

Implementing scheduled services in Sitefinity 3.x

January 22, 2010 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

In this post I will show you how to create scheduled services that could be executed on a certain period of time - hourly, daily, weekly, monthly etc. The post will expose web service that runs a Sitefinity search index. The implementation requires


1.Creating a web service in Sitefinity

2. Creating a console application that will be used to call the service

3. Using Windows Task Scheduler.


Creating a web service.



  • Leave the generated asmx in project's root. 
  • Make sure that the generated class is located in App_Code folder


In the WebMethod I'm adding getting all services using IndexDataManager object. Then I am looping through all indexes and if the name of the index that I am going to pass exists in the IndexingServiceInfo I run the index programmatically using IndexingService object


using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Services; 
using Telerik.Search; 
using Telerik.Search.Data; 
using System.Collections; 
using Telerik.Search.Engine; 
/// <summary>  
/// Summary description for IndexingService  
/// </summary>  
[WebService(Namespace = "")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.   
// [System.Web.Script.Services.ScriptService]  
public class IndexingService : System.Web.Services.WebService 
    public IndexingService() 
        //Uncomment the following line if using designed components   
    public void StartIndex(string indexName) 
        IndexDataManager dataManager = new IndexDataManager(); 
        IList indexes = dataManager.GetServices(); 
        IndexingServiceInfo indexServiceInfo = null
        foreach (IndexingServiceInfo service in indexes) 
            if (service.Name == indexName) 
                indexServiceInfo = service; 
        if (indexServiceInfo != null
            Telerik.Search.Engine.IndexingService service = 
                new Telerik.Search.Engine.IndexingService(indexServiceInfo); 
            int timeout = this.Context.Server.ScriptTimeout; 
            this.Context.Server.ScriptTimeout = 4800; 
            this.Context.Server.ScriptTimeout = timeout; 
            throw new ApplicationException("not found name"); 



Creating Console Application

  • Create the console application



  • Add Web reference to the WebService that is located in Sitefinity website


  • Implement the logic in the console application to call the WebService method, pass the name of the index and finally run it.


namespace IndexConsoleApplication 
    class Program 
        static void Main(string[] args) 
        public static void StartIndex(string indexName) 
            IndexingService client = new IndexingService(); 
            Console.Write("the website was indexed at" + DateTime.Now.ToUniversalTime().ToString()); 
            Console.Write("next index is scheduled for" + DateTime.Now.ToUniversalTime().AddDays(1).ToString()); 


Using Windows Task Scheduler

  • Open My Computer >> Management >> System Tools >> Task Schedler


  •  Click Create New Task

- Triggers tab - set the time you want to run the index

- Actions tab - set the path to the exe generated by the console application.


The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

More From Progress
ProgressNEXT: Premier Event for Modern Application Development
Read More
Seven Reasons to Check Out Sitefinity 11.1
Read More
Getting Started with Your Omnichannel Content Strategy
Read More