Reputation: 822
I'm not very familiar with Azure functions but am trying to learn and explore how to download files from a website using a time triggered function. I have the following code:
namespace PracticeFunction
{
public static class PracticeFunction
{
[FunctionName("Function1")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
using (var client = new WebClient())
{
client.DownloadFile("https://examplewebsite.com/file.zip", "zipfile");
}
}
}
}
The function executes 'successfully' but the file doesn't seem to have downloaded anywhere. I am sure I am missing something very obvious but could anyone please point me in the right direction?
Upvotes: 0
Views: 2016
Reputation: 67477
client.DownloadFile("https://examplewebsite.com/file.zip", "zipfile");
The file is downloaded in a file named zipfile
in your executable's folder, which is probably in your solution folder, in bin
and then a couple more folders deep depending on your build configuration.
Upvotes: 2