Developer forum

Forum » Development » Scheduled tasks on custom solution

Scheduled tasks on custom solution

Remi Muller
Reply

How do i enable the scheduled tasks on a custom solution?
(I can add scheduled tasks in management center but they are not executed.)

I can not find any (installation) documentation on this topic.


Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

Yeah, it can be a PITA :)

 

How it works

We have some scheduled tasks on the server and other scheduled tasks in DW. This can be a little confusing :)

The scheduled tasks in DW are just some settings stored in the database. We need a single scheduled task on the server in order to execute all the tasks that are stored in DW.

The scheduled task on the server will send a request (using curl.exe) to a certain admin page on the site every 5 minutes, 

The page requested by the scheduled task will then check if it needs to execute any tasks in DW.

 

How to set it up - Directly in Dynamicweb

If the site is hosted by Hostnordic then it should work after you have added a task in DW. If thats not the case...

When you create a scheduled task from Management Center in Dynamicweb, make sure that you choose impersonation > custom credentials.

You need to enter the credentials of an administrator on the server (we need permission to create scheduled tasks on the server). The credentials are not stored anywhere, but are only used for creating this scheduled task on the server.

Don't forget the domain when you enter the credentials! The impersonation seems to work without the domain, but the windows scheduled task will NOT be created.

If the scheduled task was NOT created successfully on the server, you should see a small error message in management center after creating a task: "Failed to handle windows scheduled task".

If you created the task successfully, there should be a message below the task list: "Completed". Now you should have a windows scheduled task on the server, placed in a folder named "Dynamicweb".

You don't have to worry about all this every time you add a new task in DW, because then the "special" scheduled task on the server will already exist.

 

How to set it up - Manually on the server

If you cannot make it work by following the steps described above, you can set it up manually if you have remote access to the server.

Create a new task and make it execute curl.exe with a URL as argument...

Action: Start a program

Program: E:\Dynamicweb.net\ApplicationStableDW8\Admin\Public\Curl\Curl.exe

Add arguments: http://www.mydomain.com/Admin/Public/TaskExecute.aspx

Schedule it to run every 5 minutes and make sure it is using the "SYSTEM" user account.

Votes for this answer: 2
 
Remi Muller
Reply

Thanks this should go into the documentation :)

 
Jeroen Elias
Reply

Are you aware that the SYSTEM account does not have network access?

So if network tasks are expected using that account, don't be surprised if they won't work.
 

 
Morten Bengtson
Reply

Jeroen, it works fine in this setup.

The windows scheduled task is just executing a program, curl.exe, which sends an HTTP request to a site on the same server.

When the actual tasks in DW are executed it is in the context of the running website, which means that it will use the account selected on the application pool, e.g. Network Service or app pool identity.

 
Marco Santos
Reply

Hello.

Morten, just tried the second example you mention, but what I am trying to execute is a Integration Framework Batch task, for which I can't see an option for the credential impersonation when creating the taks in the Management Center (get the message "Failed to handle windows scheduled task" when I try). Do you know if there is a diferent process for that case, or am I missing something ?

Thanks,

Marco Santos

 
Jonas Krarup Dam
Reply
This post has been marked as an answer

Hey Marco,

if you set up a non-integration scheduled task (just set up one for visiting www.bbc.com or something), and set up credentials for that one, those credentials will be used for the integration scheduled tasks as well.

Regards, Jonas

Votes for this answer: 1
 
Arker Soe
Arker Soe
Reply

Is there a documentation for developing custom Schedule task addin?. I want to know how to make mthe task addin to show up in the list

Can I write a custom schdule task addin to run a banch of sql update query?

schedule.PNG
 
Jonas Krarup Dam
Reply

Hi Arker,

There is a template for a scheduledTaskAddin in our Visual Studio template package.

It can be downloaded here: http://doc.dynamicweb.com/releases-and-downloads/downloads

Regards, Jonas

 

You must be logged in to post in the forum