I'm trying to use Windows Scheduled Service in order to run some scheduled tasks consistantly on time.
The tasks are indeed executing using the external service, but i get an error with it when when i don't use the windows scheduled service it doesn't throw the error:
Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized.
The code is indeed there for the OnGetCustomClass (below), why does it not work with windows schedular but does when i use the normal one? Here's the tasks's settings:
Task Assembly name: App_Code
Task Class name: NNKenticoCron.ScheduledTasks
public partial class CMSModuleLoader
/// Attribute class for loading custom classes.
private class ClassLoader : CMSLoaderAttribute
/// Called automatically when the application starts.
public override void Init()
// Assigns a handler for the OnGetCustomClass event.
ClassHelper.OnGetCustomClass += ClassHelper_OnGetCustomClass;
/// Gets a custom class object based on the given parameters.
private void ClassHelper_OnGetCustomClass(object sender, ClassEventArgs e)
if (e.Object == null)
// Checks the name of the requested class.
// Gets an instance of the CustomTask class.
e.Object = new NNKenticoCron.ScheduledTasks();
Adding a class assembly is described for the older way of adding global event handlers here. You just do the same, except the web.config settings.
"You cannot define the task in the App_Code folder if you wish to use the external service. To run a custom task externally, you must add a new assembly to your project and then define the task class there."
Any instruction on how to do this for kentico?
Please, sign in to be able to submit a new answer.