首页 > 解决方案 > 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来解决它。

标签: azurepowershelldeploymentkudu

解决方案


推荐阅读