【Azure 应用服务】在App Service中新建WebJob时候遇见错误,不能成功创建新的工作任务

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介: 【Azure 应用服务】在App Service中新建WebJob时候遇见错误,不能成功创建新的工作任务

问题描述

在Azure App Service界面上,添加新的Web Job(工作任务)时,一直添加失败。无详细错误提示,在App Service的Activity Logs(活动日志)中,根本没有添加失败的任何操作记录,这是什么情况呢?

Adding WebJob: Failed to add testwebjob01

 

问题解答

因为从错误返回窗口中没有任何的错误说明,并且App Service资源的活动日志中,没有任何记录。所以需要通过浏览器的开发者模式 ———> 网络日志中,查看在创建Web Job时候,是否成功发送出请求,请求是否又正确的响应。所以排查步骤为:

1:打开浏览器开发者模式(F12),查看网络请求。然后重新创建一个WebJob以复现问题。并查看网络请求中,所记录浏览器所发出的全部请求,查看是否又错误的结果结果,和查看浏览器Console的日志输出:

Network请求结果为:

Console日志中输出:

Access to XMLHttpRequest at 'https://xxxxxx.scm.chinacloudsites.cn/api/triggeredwebjobs/testwebjob01' from
origin 'https://portal.azure.cn' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.
[error][WebJobsViewModel][createWebJob][failed] - Failed to add web job

2:发现错误原因是:创建WebJob的请求所使用的App Service的Host(https://<your app service name>.scm.chinacloudsites.cn/api/triggeredwebjobs/testwebjob01)访问被拒绝(Error 403 - Forbidden),因为当前App Service启用了私有终结点(Private Endpoint),外面无法访问。

 

 

所以解决的办法是:

在启用Private Endpoint的内网中,寻找一台即可以访问公共网络,又可以访问内网的虚拟机(VM), 通过浏览器打开Azure门户(https://portal.azure.cn/),并重新创建WebJob,即可以成功!

 

参考资料

为 Azure Web 应用使用专用终结点:https://docs.azure.cn/zh-cn/app-service/networking/private-endpoint

若要在 Azure Web 门户中运行或执行函数,你必须具有直接网络访问权限,否则会收到 HTTP 403 错误。 换句话说,你的浏览器必须能够访问专用终结点,以便从 Azure Web 门户执行该函数。

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
8天前
【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub的解决之法
An exception occurred while retrieving properties for Event Hub: logicapp. Error Message: 'ClientSecretCredential authentication failed: AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Che
|
14天前
|
安全
【Azure App Service】App service无法使用的情况分析
App Service集成子网后,如果子网网段中的剩余IP地址非常少的情况下,会在App Service实例升级时( 先加入新实例,然后在移除老实例 )。新加入的实例不能被分配到正确的内网IP地址,无法成功的访问内网资源。 解决方法就是为App Service增加子网地址, 最少需要/26 子网网段地址。
|
23天前
|
开发框架 .NET Windows
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
|
23天前
|
C++
【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub
【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub
|
23天前
【Azure Logic App】在逻辑应用中开启或关闭一个工作流是否会对其它工作流产生影响呢?
【Azure Logic App】在逻辑应用中开启或关闭一个工作流是否会对其它工作流产生影响呢?
|
23天前
|
安全 前端开发 网络安全
【Azure App Service】访问App Service应用报错 SSL: WRONG_VERSION_NUMBER
【Azure App Service】访问App Service应用报错 SSL: WRONG_VERSION_NUMBER

热门文章

最新文章