azureazure-webjobsasp.net-webhooks

Azure WebJob Console Application Empty Args when calling from webhook


I'm working on Azure WebJob. I started by creating a console application in Visual Studio and I published the application as a webJob in portal.azure from VisualStudio.

the WebJob is Triggered Manualy from its Webhook with username and password https://{MyWebAPP}.scm.azurewebsites.net/api/triggeredwebjobs/{MyWebJob}/run?arguments=1 2 3 from a second program.

this WebJob is verry simple. It only displays a the arguments 1,2 and 3.

when I run the program from CommandeLine like so dotnet MyProject.dll 1 2 3 it works well. but when I run it from webHook it does not read arguments.

here is my main script :

 class Program
{
    static void Main(string[] args)
    {

        Console.WriteLine("PARAMS Passed : " + string.Join(",", args));
    }
}

This is the log in the WebJob when I run from WebHook by Post request : [06/09/2018 15:19:37 > 33a9f2: INFO] PARAMS Passed :

and this is the console when I run it from commande Line : [06/09/2018 15:19:37 > 33a9f2: INFO] PARAMS Passed : 1,2,3

Can some One Help PLEASE. Tha,ks From All.


Solution

  • This comes down to a VS publishing bug. The problem is that it auto-generates a run.cmd that has:

    dotnet foo.dll
    

    When it really should have:

    dotnet foo.dll %*
    

    So that the arguments get flowed into your console app.

    I'll report the issue, but for now you can work around as follows:

    That will cause your run.cmd to get deployed, and VS won't auto-generate the faulty one.