我已经使用基于 HttpTrigger 的 Azure 函数实现了 Rest API 调用,现在客户要求使用 Azure Web 作业而不是 Azure Functions 来实现相同的调用(由于成本)。
是否有任何可用选项,请提供一些如何在 Azure Web 作业中实现它的引用
谢谢!提前
最佳答案
不,这不是 WebJobs 的用途。您可能正在考虑构建 ASP.NET Web API 并将其托管在应用服务计划中。
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same context as a web app, API app, or mobile app. There is no additional cost to use WebJobs.
取自 Run Background tasks with WebJobs in Azure App Service
此外,WebJobs 不支持 HttpTrigger。 WebJobs 支持的触发器:
- 计时器
- Azure 存储队列和 blob
- Azure 服务总线队列和主题
- Azure Cosmos DB
- Azure 事件中心
- 文件系统
来源:What are Microsoft Flow, Logic Apps, Functions, and WebJobs? - Comparison table
编辑:
就您的解决方案而言:在函数或应用程序服务中运行它。如果只是一次 HttpTriggered 调用,并且 API 不活动后的(次要)启动时间不是问题:请使用 Function 实现。
当检索“大量”记录时(什么是大量?),只要您的函数没有任何状态并且您传入所有信息来确定要接收的记录,就不应该有任何问题。消费计划中的Function应用超时时间默认为5分钟。
关于azure - 使用 Azure Web 作业进行 Rest API 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55183195/