dotnet core Azure webjobs 没有被触发

dotnet core Azure webjobs not being Triggered

我有一个使用 dotnet 核心构建的 Azure 网络作业,它已部署到 Azure 应用服务上的部署槽。我已按照以下说明进行操作:https://blogs.msdn.microsoft.com/azuredev/2018/08/22/webjobs-in-azure-with-net-core-2-1/ 为了在正确的文件夹中发布 webjob 以及添加 run.cmd 来调用 dll。

正在通过 VSTS 部署 Web 作业。与博客 [​​=19=] 中描述的方式相同。 (在 App_Data\jobs\ 文件夹下)。出于某种原因,如果我部署到 App_Data\jobs\continuous 而不是 App_Data\jobs\triggered,它只会使消息出队。有什么线索吗?

Many file types are supported, but for us Windows users it makes sense to use an exe, cmd, bat or PowerShell file. A Console App used to be an exe file, but in .NET Core, it produces a regular DLL file that we need to start manually.

正如您提供的 link,运行 的 WebJob 需要一些可执行脚本才能开始。而对于.net core,需要手动执行dll文件才能启动。

虽然我们也需要执行run.cmd,但是我们无法自己创建。您可以下载此 webjob core sample,它在 dotnet 核心 2.0 应用程序中使用 Azure WebJobs SDK。当你部署到 azure 时,它​​会自动创建一个 run.cmd 文件来启动 webjob。

我认为您的问题是关于 "Triggered Web Job" 应该做什么的预期。措辞令人困惑,但触发 WebJob 仅在 triggered manually or on a schedule 时启动。你想要的是一个连续的 WebJob。您可以将其视为 WebJob 不断 寻找将触发您的代码执行的队列输入。

David 很好地回答了 中的问题,因此我将重新发布他的部分回答:

It sounds like you are using the Azure WebJobs SDK. In SDK scenarios, even though your individual functions are 'triggered', the WebJob as a whole runs continuously (i.e. your exe keeps running and does its own internal triggering).