手动触发的Azure Webjob不止一次被触发。返回409(冲突)错误

时间:2018-02-11 04:39:03

标签: java azure web-applications azure-webjobs azure-webjobs-triggered

没有为此设置Azure Scheduler。这个webjob是我从Azure门户上传的jar文件。

告诉我如何添加settings.job文件以及.jar和.bat压缩包。 我希望这会覆盖让我的工作触发两次的任何东西。

以下是日志:

2018-02-09 15:00:05 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=0ed7d17e-4514-4261-8c85-0479f5df1729 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-41de4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/custdata-app/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 custdata-app.scm.azurewebsites.net 200 0 0 576 2534 203
2018-02-09 15:02:57 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run X-ARR-LOG-ID=21c8d186-0365-4230-b62a-321c7cb8d63f 443 - 94.56.200.242 - - - custdata-app.scm.azurewebsites.net 202 0 0 610 1040 223
2018-02-09 15:03:02 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run X-ARR-LOG-ID=c305c72a-c441-429f-9524-d637428ec9d4 443 - 94.56.200.242 - - - custdata-app.scm.azurewebsites.net 409 0 0 554 1022 5125
2018-02-09 15:04:49 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run X-ARR-LOG-ID=0ab4d325-46c0-4874-b5fb-5a853da182e2 443 - 94.56.200.242 - - - custdata-app.scm.azurewebsites.net 202 0 0 610 1040 184
2018-02-09 15:04:55 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run X-ARR-LOG-ID=2c188dff-0c6a-42ab-b2ba-a4920e777b98 443 - 94.56.200.242 - - - custdata-app.scm.azurewebsites.net 409 0 0 579 1022 5109

你可以从日志中看到它返回409错误,因为这里触发了两次。虽然我刚刚触发了一次。 知道为什么会出现这种情况吗?

也没有临时插槽。

此外,当我今天检查日志而没有触发它时,它们看起来像这样

#Software: Microsoft Internet Information Services 8.0
#Fields: date time s-sitename cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2018-02-12 04:00:07 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=b84a1519-4150-4e81-9b30-d899aa9278a7 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 171
2018-02-12 04:05:06 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=e66c81cc-6012-445e-9b72-62625696571d 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 171
2018-02-12 04:10:06 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=fbf98e91-63f2-4056-9708-5770fab9d1bf 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 187
2018-02-12 04:15:07 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=d0fdd922-5f58-497c-b3f2-d107d83f516a 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 187
2018-02-12 04:20:06 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=cff05bb4-07fa-4b44-9c4f-a9cac5f6d61b 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 125
2018-02-12 04:25:07 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=ccd1cbba-589c-4d75-b103-12736d393b02 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 193
2018-02-12 04:30:05 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=c705f17e-09c8-4921-b2b7-88fa4671cbcd 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 156
2018-02-12 04:35:09 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=9d353a60-e919-4252-8c41-21e907fa0ad6 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 125
2018-02-12 04:40:07 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=fb183ad4-b63d-4936-8864-1daf0935110d 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 203
2018-02-12 04:45:06 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=e9608806-7a88-43cb-8918-3bec695ff920 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 157
2018-02-12 04:50:06 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=7dbcab05-2076-4012-939b-523d7487bda0 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 188
2018-02-12 04:55:07 ~1CUSTDATA-APP POST /api/triggeredwebjobs/GoogleAn/run api-version=2016-08-01&X-ARR-LOG-ID=bc930307-f6d9-48f7-b545-398597de91cd 443 - 70.37.57.58 AzurePowershell/v1.4.0.0 - https://management.azure.com/subscriptions/5b-342f-4641-bfa6-419c20edde4c/resourceGroups/custdata-rg/providers/Microsoft.Web/sites/CUSTDATA-APP/TriggeredWebJobs/GoogleAn/run?api-version=2016-08-01 CUSTDATA-APP.scm.azurewebsites.net 200 0 0 576 2534 125

所以你可以看到它每5分钟触发一次。知道为什么会自动发生这种情况吗?有没有我不知道的调度程序?

我设法输入了settings.job。以下是它的外观:enter image description here

1 个答案:

答案 0 :(得分:0)

我们知道,Azure App Service中的WebJobs有两种类型:ContinuousTriggered

Continuous WebJobs使作业无法结束,程序或脚本通常在无限循环中完成工作。另一方面,Triggered WebJobs被手动触发或作为计划自动触发。根据您的情况,显然您正在运行Triggered WebJobs

您可以在浏览器中访问Kudu地址:

https://<your app name>.scm.azurewebsites.net/DebugConsole

然后进入webjobs文件夹并找到settings.job文件:

D:\home\site\wwwroot\App_Data\jobs\triggered\sample>

enter image description here

这意味着我的webjobs将每5秒自动播放一次。

希望它对你有所帮助。

更新答案:

您可以在评论中查看@David Ebbo提到的settings.job reference

比较您提供的settings.jobis_singleton和其他属性仅在Continuous WebJobs上使用。

我创建了一个手动webjob并运行它。但未发现生成任何settings.job。我建议您删除settings.job并再次测试。