powershell - 部署到 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脚本有问题吗?
解决方案
谢谢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 作业文档以获取更多信息。还要检查该文档中的相关链接。
推荐阅读
- c++ - 如何将算术运算符添加到 std::array?
- c# - 如何将信息从 DataGridView 发送到文本文件
- python - 如何从我的 main.py 脚本访问我的 Spider 数据?
- c# - 在彼此下方创建 2 个 FrameLayout
- node.js - 使用 Node.js 进行 REST 调用以从 Azure Cosmos DB 检索单个文档时出现“无效的分区键”
- sql - 分组集,汇总但具有多列
- visual-studio-code - 如何在 vs2019 或 vscode 中调试 Angular SPA
- c++ - 运行dijkstra算法的问题
- javascript - 如何恢复默认事件侦听器以提交表单
- c - Leetcode:AddressSanitizer 堆缓冲区溢出