azure - Kudu zipdeploy with POWERSHELL throwing The remote server returned an error: (500) Internal Server Error
问题描述
我们正在尝试使用带有 KUDU ZIPDEPLOY 的 POWER SHELL 部署 Web 应用程序,但由于 (500) 内部服务器错误而失败。
有趣的是,它与 CURL 命令配合得很好。
主要区别在于,在 CURL 中我没有使用代理,但 POWER SHELL 它要求提供代理详细信息。我想这可能是我从组织网络部署的。
$username = "`*********"
$password = "********"
$pair = "$($username):$($password)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
$deployUri = "https://testexploreazurewebsites.scm.azurewebsites.net/api/zipdeploy?isAsync=true"
$proxyUri = [Uri]$null
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
if ($proxy)
{
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$proxyUri = $proxy.GetProxy($deployUri)
}
$sourceFilePath = "FilePath.zip"
$responseHeaders = Invoke-WebRequest -Uri $deployUri -ContentType "multipart/form-data" -Method Post -Proxy $proxyUri -ProxyUseDefaultCredentials -Headers $Headers `
-InFile $sourceFilePath `
-TimeoutSec 600000
几天前它工作得很好,突然停止工作。
请问有什么帮助吗?
更新和回答
来自 Kudu 日志文件,错误描述是:缺少内容类型边界。按照SF post powershell invoke-restmethod multipart/form-data来解决它。
解决方案
推荐阅读
- llvm - LLVM Pass - 替换 GlobalVariable 的问题
- json - 在 React 中递归渲染嵌套数据,我想恢复这个文件 json 的“名称”
- redis - haproxy pod 保持 crashloopbackoff
- arrays - 将数组转换为哈希
- angular - Angular Reactive FormGroup 值更改不会在可观察到的情况下发出更改
- sapui5 - 我如何启动本地服务器(通过 gulp)并在 pom.xml 中在此服务器上运行自动测试
- javascript - curl to GitHub personal_access_token 仅从我的 mac 失败
- powerbi - 计算 Power BI 中过去 n 周的平均值
- javascript - 为什么这个输出未定义?
- java - Hibernate 配置文件:无法读取所需库 persistence.xml 的存档