azure - 如何从我的网站启动 Azure Web 作业?

标签 azure azure-webjobs

我正在将 azure web 作业用于一个计划。我想将其设为按需格式,并希望在单击我的网站上的按钮后开始工作。有可能吗?

提前致谢。

最佳答案

您可以通过 WebJob API 触发 WebJob。 C# 代码包含在以下帖子中:

http://chriskirby.net/blog/running-your-azure-webjobs-with-the-kudu-api

HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://mysiteslot.scm.azurewebsites.net/api/");
// the creds from my .publishsettings file
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
// POST to the run action for my job
var response = await client.PostAsync("triggeredwebjobs/moJobName/run", null)

这必须在服务器端完成,因为您不希望授权信息暴露在客户端。

关于azure - 如何从我的网站启动 Azure Web 作业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37968496/

相关文章:

azure - 如何在 Azure 中的 ubuntu 中启用互联网连接

azure - 如何阻止 Azure WebJobs 队列消息从 Azure 队列中删除?

unit-testing - 在 Visual Studio 2015 中加密 SQL 单元测试的 ConnectionString

azure - 仅获取与 Azure CLI 中的特定字符串相似的网卡名称

web-services - 如何为现有本地群集配置和启用 Azure Service Fabric 反向代理?

azure - 发布 Azure WebJob,包括 bin 文件夹中的所有项目

c# - Azure WebJobs 和 ServiceBusTrigger

azure - 错误 : The specified registry key does not exist. 尝试使用网络凭据连接到 TFS 2012。

c# - 从队列触发器启动 Azure 辅助角色

Azure Webjob 计时器触发器不触发