首页 > 解决方案 > 部署到 Azure Web App 后找不到 webjob?

问题描述

我在 Azure 中有一个 webapp,在 RG TestRG 中有一个 TestApp。我创建了一个用于部署的 zip 并使用以下 powershell 脚本

az webapp deployment source config-zip -n "TestApp" -g "TestRG" --src "c:\test\deployfile.zip"

它发出警告

“az:获取 zip 部署的 scm 站点凭据”

然后它说以下内容:

Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202

但在那之后我得到一个json响应,它在provisioningState字段下成功。

当我在设置 -WebJobs 下导航到 Azure 中的应用程序服务时,我没有看到该 Web 作业?

powershell脚本有问题吗?

标签: powershellazure-webjobs

解决方案


谢谢SnehaAgrawal-MSFT。发布您的建议作为答案以帮助其他社区成员。

要部署网络作业,请检查您的目录结构。尝试创建一个压缩到d:\home\site\wwwroot的 zip 文件,打开 ZIP 文件后,您将在其中找到一个名为 App_Data 的文件夹。

下面的代码将帮助您部署 Azure Web 作业。

param
(
    [string] $buildOutput = $(throw "Directory with build output is required"),
    [string] $resourceGroupName = $(throw "Resource group name is required"),
    [string] $webAppName = $(throw "Web app name is required"),
    [string] $webJobName = $(throw "Web job name is required"),
    [string] $webJobType = "triggered"
)
 
$currentDir = (Get-Item .).FullName
$tempDir = "$currentDir\Temp"
$webJobDir = "$tempDir\App_Data\jobs\$webJobType\$webJobName"
 
New-Item $webJobDir -ItemType Directory
Copy-Item "$buildOutput\*" -Destination $webJobDir -Recurse
Compress-Archive -Path "$tempDir\*" -DestinationPath ".\$webJobName.zip"
Remove-Item $tempDir -Recurse -Force
 
az webapp deployment source config-zip -g $resourceGroupName -n $webAppName --src "$webJobName.zip"

 

您能否查看部署 Azure Web 作业文档以获取更多信息。还要检查该文档中的相关链接。


推荐阅读