help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

AxCMS.Service

Installation and configuration of the AxCMS.Service

There’s need to do something in background in both AxCMS.net and custom project. This applies to time-consuming tasks (like making snapshots of the pages), regular scheduled tasks (like reporting), etc. The goal of AxCMS.Service is to provide unified way for executing tasks in background for both AxCMS.net and custom projects.

There are some default tasks, tah AxCMS.Service provides:

IndexTextTask - this tasks performs text indexing. It is added automatically on page or document saving or publishing. Task parameters have format of Field=IndexedText, e.g. Name=Page1. ElementID and ElementType must also present to associate the index with the element. 

IndexFileTask - this task perfoms file indexing. It is added automatically on page or document saving or publishing. The task is basically the same as IndexTextTask, but it retrieves the text from the supplied file name. The task relies on Microsoft IFilter technology for getting the file text to index. Read more about IFilters here.

NewsletterQueueTask - this task performs customizing and sending of the newsletters. It replaces NewsletterSyndicationService used before. Task parameters have format of NumberOfNewslettersToSend,ResourceManagerToUse, e.g. 1,LIVE.

CmsActivity - CmsActivity and all its children implement now IServiceTask interface and thus can be scheduled. Before they were scheduled with Background executor. Task parameter is serialized instance of CmsActivity itself.

EmailGateway - this task performs checking of the specified mailbox, getting mails out of it, processing them and deleting them. This task does not do anything, but publishes the mail with ExceptionManager. You should inherit from this task and override ProcessMail method, which is called for every message. Task parameter is connection string to the mailbox, in format Server=mailserver.somewhere;Port=110;Username=myUser;Password=myPassword

AxTaskEmailGateway - implementation of EmailGateway. This task checks the e-mails coming to the specified mailbox and creates AxCMS.net tasks out of them. You should schedule it same way as any e-mail gateway task. To assign a AxCMS.net task to an user, send this user an e-mail with CC to the mailbox of this task. To: field will become owner of the task, From: field will become creator of the task, Subject: will become title of the task and message body will be the task description. Both owner and creator e-mails must match e-mails in their AxCMS.net user profile.

AxDocumentEmailGateway - implementation of EmailGateway. This task checks the e-mails coming to the specified mailbox and creates AxCMS.net documents from mail attachments. You should schedule it same way as any e-mail gateway task. To upload a document to  AxCMS.net, send the e-mail with a document attached to mailbox of this task. All attachments of the mail will be uploaded as documents in AxCMS.net, attachment name will become document title, mail subject will become document caption and mail body will become document description, user who sent the e-mail will become author of the document. User e-mail must match e-mail in AxCMS.net user profile. Note: only binary files will be accepted by AxDocumentEmailGateway.

You can schedule a task by inserting a row into the database, e.g.
INSERT INTO [AxServiceTask]
(AxID,Active,ClassName,AssemblyName,Parameters,ExecutionInterval)
VALUES
(2,1,'Axinom.AECMS.page.NewsletterQueueTask','AxCMS.BL','1,LIVE',60)

Installing AxCMS.Service

  1. Copy the AxCMS.Service folder from the installation media to any location on your computer, e.g. C:\Program Files\AxCMS.Service
  2. Open this folder and run register.bat.
  3. Configure the AxCMS.Service how described in the next paragraph.
  4. Open the Control Panel, go to the Administration Tools, open the Services applet, find the AxCMS.Service there and click the "Start Service"-button.
  5. The AxCMS.Service should now run and manage your background tasks.

Configuration


AxCMS.Service will have its own configuration file AxCMS.Service.exe.config. You should declare all the service instances to run:

<ServiceInstances>
<ServiceInstance name="AxCMSweb_MS">
<Context path="/AxCMSweb" site="Default Web Site"/>
<Settings threadCount="5" sleepTime="60" errorSleepTime="3600" />
</ServiceInstance>
<ServiceInstance name="AxCMSweb_LS">
<Context path="/AxCMSwebLive" site="Default Web Site"/>
<Settings threadCount="5" sleepTime="60" errorSleepTime="3600" />
</ServiceInstance>
</ServiceInstances>

When using custom sites You should declare instances as following, eg:

<ServiceInstances>
<ServiceInstance name="AxCMSweb_MS">
<Context path="/" site="MYCOMPANY - cms.mycompany.de"/>
<Settings threadCount="5" sleepTime="60" errorSleepTime="3600" />
</ServiceInstance>
<ServiceInstance name="AxCMSweb_LS">
<Context path="/" site="MYCOMPANY - www.mycompany.de"/>
<Settings threadCount="5" sleepTime="60" errorSleepTime="3600" />
</ServiceInstance>
</ServiceInstances>


Context element determines the configuration context of the instance. Set the site to the CMS site to be monitored and path to the virtual path of the system.
Settings element sets various settings of the instance:
* threadCount is the number of threads to create for each task
* sleepTime is the amount of seconds to wait between trying to execute next set of tasks
* errorSleepTime is the amount of seconds to wait if critical error has occured (e.g. DB is not accessible).

Exception publisher also has to be defined for logging the exceptions occured during task execution. If you use ExceptionPublisherMail, you also have to add appSettings section with SmtpServer key.

<appSettings>
<add key="SmtpServer" value="mail.axinom.de" />
</appSettings>

 

NB! AxCMS.Service version must be the same as instance.

Uninstalling AxCMS.Service

Run unregister.bat under AxCMS.Service directory where from you installed it previously. Make sure that the name in .bat file is the same as the service name.