azurecronwebjob

Making a Azure WebJob run a console application


I'm trying to setup a scheduled WebJob (every minute). I've made a Windows Console Application in VS 2019 like this:

using System;
using System.Net;

namespace EveryMinute
{
    class Program
    {
        static void Main(string[] args)
        {
            WebRequest request = WebRequest.Create("https://some.url.com");
            WebResponse response = request.GetResponse();
        }
    }
}

The output of this request is not important, I just need the url to be triggered every minute. I can run the exe on my Windows computer. But when I create a WebJob with this exe attached, I keep getting a [failed] notice every minute.

Error response in Azure

Can anyone tell me what I am doing wrong?

Thank you for your help.


Solution

  • To make the answer visible to others, I'm summarizing the answer as below:

    I don't know if I can send that dll together with other files in the zip?

    Yes, we need to add all the contents under Bin/Debug(/net472) path in a .zip file.

    enter image description here

    We can also deploy the webjob in vs by clicking publish button.

    enter image description here

    If your job fails, you can find the detailed error message in the Run Details.

    enter image description here

    enter image description here