Command Line Arguments to Azure Webjobs

二次信任 提交于 2019-12-30 06:24:28

问题


I'm in the process of migrating a couple of Jobs that were previously scheduled and run through Quartz.Net to Azure Webjobs.

Using Quartz.Net allowed me to have all the (very compact) Job Classes in the same project as the console program entry point initializing the scheduler.

Now I would like to retain that structure without having to create a discrete console application project for each and every web job.

Is there currently any way to configure a command line argument for continuous web-job that would allow to branch internally to the correct job depending on the command line argument?


回答1:


In Azure WebJobs one way to do this is to create a script file for each WebJob with the command line arguments: MyApplication.exe arg1 arg2.

Another would be to select the method to run by the current WebJob name which you can get from the environment variable WEBJOBS_NAME.

For triggered WebJobs there is support for command line arguments (per run) in the API but it is still unsupported by the Azure portal: https://github.com/projectkudu/kudu/wiki/WebJobs-API#invoke-a-triggered-job.



来源:https://stackoverflow.com/questions/24865828/command-line-arguments-to-azure-webjobs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!