When I publish a site on existing one where I created multiple webjobs, this deletes all the files on server and all the web jobs are deleted.
I assume this is because webjobs are stored in App_Data folder. When the APP_Data directory is deleted, the jobs are deleted.
How can I avoid deleting the app_data folder when doing a publish?
A third option to Andy's answer would be to deploy you WebJobs with your website, just make sure the WebJobs scripts go to the right place which is under app_data\jobs\{job type: continuous/triggered}\{job name}
.
See more about deploying WebJobs: http://blog.amitapple.com/post/74215124623/deploy-azure-webjobs/
I noticed this as well and can offer the solutions I came up with.
If you are publishing from Visual Studio you can deselect the file publish option "Remove additional files at destination". Of course you are now no longer deleting unused files on the server which probably isn't ideal.
The other option is to simply create a second website just for your webjobs. You can leave the site blank, you don't need to publish anything to it or configure anything beyond the webjobs. One advantage to this approach is you can monitor (and potential scale) the webjobs site separately from your original website.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With