Windows Scheduler Service not working correctly

Namita Patil asked on May 12, 2021 08:44

Hi,

We are facing issue with installed Kentico's windows scheduler service on our QA server.

Our admin website is internal website and moreover it's not being used frequently. That's why we had an issue with scheduling tasks/jobs and emails send functionality failure - i.e. whenever admin website is not opened for long time - these scheduler jobs stops running automatically at scheduled time and emails are getting stuck in email queue, so we installed Kentico's Scheduler service and enabled custom scheduler task to "User External Service". But, somehow it's not continuously working - after some inactive session, it stops working.

I want to check if we are missing any setting on IIS or Kentico, because of which Kentico's windows scheduler service is not working as expected.

Thanks!

Namita Patil

Recent Answers


Dmitry Bastron answered on May 12, 2021 10:17

Hi Namita,

Do you actually have Scheduler Service installed on your server?

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 12, 2021 18:08 (last edited on May 12, 2021 18:09)

No, we have Kentico Service Manager 12 installed on our staging server for testing, as we are on Kentico 12 right now.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 13, 2021 08:04

But, do you have that scheduler service installed and running? Open the Services management console (type services.msc into the Start menu search box) and check whether you see the Kentico scheduler service there or not. And also check that it is running.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 13, 2021 19:27

Yes, Kentico CMS Scheduler(K12MVC/K12MVC) service is running in both Services management console as well as Kentico Service Manager from day 1.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 14, 2021 06:24

What version and hotfix are you using? Also, are other tasks being executed? I tested this on Kentico 12 and 13 and it is working fine. I have created a custom scheduled task which is generating emails into the queue. And the emails are being sent out by another, default Kentico scheduled task.
I have installed the scheduler service and configured everything as described in the documentation.
The scheduled tasks are running fine and I am receiving the emails - this means both tasks are being executed. I then even stopped the application pool in which Kentico is running, so the admin app was inaccessible and I was still receiving the emails - this means that the tasks were executed even when Kentico was not running.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 14, 2021 19:17 (last edited on May 14, 2021 20:19)

We are using version K12 and hotfix version of 12.0.92.

Actually there are 2 different issues after enabling Windows Scheduler Service - 1. Report subscription Email/ any email send stops after some days - most probably when no-one is logged in to admin website. 2. Custom scheduler task don't work at all - if marked as "Use External Service".

Looks like it's failing the scheduled task as this task is internally calling custom module data. This custom scheduler Task is failing on line where we are calling to custom module data RatesInfoProvider.GetRates(). But this fails only if we mark this custom scheduled task to "Use External Service" option on task. If we uncheck the "Use External Service" - it works perfectly fine.

Also, I tried stopping application pool just to see if the report subscription emails are going or not - but it don't send email after application pool stopped for admin website.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 14, 2021 20:40

If no one is logged into the Admin app - this sounds like the Windows service is not installed for that instance. What you have described is the typical issue since the scheduler thread is executed within the Kentico admin app by default - if the app is not running, scheduler is not running too. I would recommend re-viewing the scheduler service and also make sure you are using EMS license keys.
For the custom task - if it requires context from Kentico app, you cannot use the external service. The context is not available when tasks are executed outside the application. Therefore, you cannot execute such tasks using the Windows service.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 25, 2021 19:08 (last edited on May 25, 2021 21:53)

In application pool of admin website, start mode is already set to AlwaysRunning, is there any other setting I need to check on IIS?

Just for info - live site's application pool's start mode is set to OnDemand, do I have change it as well?

Also, EMS license keys is the one which is there in Licenses, just wanted to confirm this.

For the custom task - what if I use API to get the data from my custom module just for one instance and that issue will be resolved. I don't think by calling custom module through API needs any context from Kentico App. In this case, I can use the external service. Any suggestion here?

Also, in IIS -> application pool, do you set any time in Recycling specifically? I have Regular Interval time set as 1740 in application pool for admin website. Do you have any guidelines/set-up link specifically for IIS settings for admin website? we have our admin website setup aligned with below guidelines: https://docs.xperience.io/k12sp/installation/manually-configuring-kentico-applications-in-iis

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.