命令行参数的Azure Webjobs [英] Command Line Arguments to Azure Webjobs

查看:338
本文介绍了命令行参数的Azure Webjobs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在迁移几个乔布斯先前计划,并贯穿Quartz.Net天青Webjobs的过程。

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

使用Quartz.Net让我让所有的(非常紧凑)工作类在同一个项目作为控制台程序入口点初始化调度程序。

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.

现在我想保留这个结构,而无需创建每个Web作业离散控制台应用程序项目。

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?

推荐答案

在Azure中WebJobs做到这一点的方法之一是创建一个脚本文件使用命令行参数每个WebJob: MyApplication.exe ARG1 ARG2

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.

另一个办法是选择当前WebJob名称来运行它,你可以得到的方法从环境变量的 WEBJOBS_NAME

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

有关触发WebJobs有API中的命令行参数的支持(每次运行),但它仍然是不受支持蔚蓝的门户网站: https://github.com/projectkudu/kudu/wiki / WebJobs-API调用#-A-触发作业

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.

这篇关于命令行参数的Azure Webjobs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆