I have used the sample code to backup MS SQL databases via the API and modified it slightly to run as a Generic handler on my cloud site so that I can do automated backups using the scheduler add-on.
It saves the backup file in the App_Data folder.
It was working great last time I ran it (some time ago as this site is not live yet).
Now I am getting a file in use error: "The process cannot access the file 'C:\home\site\wwwroot\App_Data\backupx2.zip' because it is being used by another process." It failes on webClient.DownloadFile.
The backup does take a few minutes (800MB database) and the error comes up after a few minutes.
I've tried different file names, and I haven't actually created the scheduled task yet so that can't be causing any issues.
Any idea why the file could be in use or how to solve this issue?