Disable Task Scheduler Through Web.config

Daniel Maley asked on January 3, 2018 20:59

Hello, is there any method for disabling scheduled tasks through something like the Web.config? We have an issue were we have several marketing emails that are scheduled to be sent out at various times. When we pull down a local copy of the database these emails were being sent out accidentally. It would be great if we could disable this for our local site. If its not possible to disable scheduled tasks can you disable emails? We already had a SQL script that we are running to change the "run scheduled tasks" setting to false, however, this is an additional step that is easily forgotten after pulling down the database. Any ideas !?!

Correct Answer

Juraj Ondrus answered on January 4, 2018 08:38

Brenden is correct. The only way is disable the individual tasks in the configuration by unchecking the Task enabled option. Or, additionally to what Brenden suggested with clearing/changing the SMTP configuration would be using the web.config key to debug emails - which disables sending of emails to the actual recipients. The system only logs emails into the event log. Helpful if you need to test the functionality, but do not want the emails to actually reach the recipients.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on January 3, 2018 23:38

Not sure you can disable individual scheduled tasks with a web.config key but you can disable the scheduler all together in the web.config. Not sure this is the best option though.

A simple way you can disable sending emails by clearing your SMTP provider settings. This way the emails will stay in the queue but have no where to go since there is no ability to send them out.

0 votesVote for this answer Mark as a Correct answer

Daniel Maley answered on January 5, 2018 16:34 (last edited on January 17, 2018 20:48)

Thanks all! This should get us what we need. Brenden we did have a sql script that was setting the enable scheduled tasks to false and clearing the SMTP settings, this does work but you have to remember to run it every time you pull a copy of the database. I did not know about the debug email setting, I think I like that approach more as it can be set and checked-in to source control eliminating the risk of this happening again. Thanks!

0 votesVote for this answer Mark as a Correct answer

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