简体   繁体   English

Azure Webjobs的命令行参数

[英]Command Line Arguments to Azure 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运行到Azure Webjobs的几个Jobs。

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. 使用Quartz.Net允许我在与初始化调度程序的控制台程序入口点相同的项目中拥有所有(非常紧凑的)作业类。

Now I would like to retain that structure without having to create a discrete console application project for each and every web job. 现在我想保留该结构,而不必为每个Web作业创建一个独立的控制台应用程序项目。

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? 目前是否有任何方法可以为连续Web作业配置命令行参数,以允许根据命令行参数在内部分支到正确的作业?

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 . 在Azure WebJobs中,一种方法是使用命令行参数为每个WebJob创建一个脚本文件: 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 . 另一种方法是选择当前WebJob名称运行的方法,您可以从环境变量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 . 对于触发的WebJobs,API中支持命令行参数(每次运行),但Azure门户仍然不支持它: https//github.com/projectkudu/kudu/wiki/WebJobs-API#invoke-a-triggered - 工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM