手动运行预定的Azure WebJob(Running a Scheduled Azure WebJob Manually)

编程入门 行业动态 更新时间:2024-10-25 00:30:39
手动运行预定的Azure WebJob(Running a Scheduled Azure WebJob Manually)

我在Azure中安排了一个每晚运行的WebJob。 偶尔,我发现我需要在白天任意时间运行这项工作。

我希望能够在我喜欢的时候手动重新运行这份工作。 这可能吗? 我可以在门户网站上看到调度程序设置为点击URL:

https://XXX.scm.azurewebsites.net/api/triggeredjobs/YYY/run

使用POST 。 我试过自己点击这个URL。 如果我这样做是GET ,我会得到404,如果我尝试POST那么我会收到授权失败:

401 - 未授权:由于凭据无效,访问被拒绝

我可以构建必要的标题或任何做auth的东西,但这感觉就像牦牛剃须。

这似乎(对我而言)就像一个简单的用例,并且肯定在Azure门户或Kudo的某个地方有一个按钮?

I have a scheduled WebJob in Azure that runs nightly. Occasionally, I find that I need to run this job during the day at arbitrary times.

I would like to be able to manually re-run the job when I feel like it. Is this possible? I can see in the portal that the scheduler is set to hit the URL:

https://XXX.scm.azurewebsites.net/api/triggeredjobs/YYY/run

using a POST. I have tried to hit this URL myself. If I do it as a GET, I get a 404, and if I try a POST then I get an authorisation failure:

401 - Unauthorized: Access is denied due to invalid credentials

I could probably construct the necessary headers or whatever to do the auth, but this feels like yak shaving.

This seems (to me) like a trivial use case, and one that surely there's a button for somewhere in the Azure portal or Kudo?

最满意答案

请求需要身份验证(你应该对此感到高兴:)) 这篇文章展示了如何形成正确的基本身份验证URL以调用你的工作,并解释了你可能感兴趣的幕后工作方式。

但是, 您也可以从门户网站运行您的作业 。 如果右键单击要运行的作业的门户,您将看到“运行”上下文菜单项。 我知道不是很难发现:(

There is authentication required on the request (you should be happy about that :)) This post shows how to form the correct basic auth URL to invoke your job, and also explains how things work behind the scenes which may interest you.

However, you can also run your job from the portal. If you right click in the portal on the job you want to run, you'll see a "Run" context menu item. Not very discoverable I know :(

更多推荐

本文发布于:2023-04-27 23:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329654.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WebJob   Azure   Running   Manually   Scheduled

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!