【发布时间】:2016-01-06 23:54:07
【问题描述】:
我真的很接近完成我的工作,但它开始导致这个错误。
当我执行此操作时
Save-AzureWebSiteLog -Name $WebSiteName -Output "C:\logs\error.zip"
Save-AzureWebSiteLog :传入的最大邮件大小配额 已超出消息 (65536)。要增加配额,请使用 相应绑定元素上的 MaxReceivedMessageSize 属性。
所以,我搜索了解决方案,似乎很多人都有完全相同的问题。
https://azure.microsoft.com/en-us/blog/windows-azure-websites-online-tools-you-should-know-about/
感谢@Parth Sehgal,我尝试使用powershell 解决问题
$username = "maiemai"
$password = "Password"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiUrl = "https://wngphase2it.scm.azurewebsites.net/api/zip/LogFiles/"
$response = Invoke-WebRequest -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method GET
try
{
$filename = [System.IO.Path]::GetFileName($response.BaseResponse.ResponseUri.OriginalString)
$filepath = [System.IO.Path]::Combine("c:\asdf\", "http1.zip")
$filestream = [System.IO.File]::Create($filepath)
$response.RawContentStream.WriteTo($filestream)
}
finally
{
$filestream.Close()
}
但我遇到了这个错误
Invoke-WebRequest:服务器错误 401 - 未经授权:由于凭据无效,访问被拒绝。 您无权使用您提供的凭据查看此目录或页面。 在行:5 字符:13 + $response = Invoke-WebRequest -Uri $apiUrl -Headers @{Authorization=("Basic {0}" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], 网络异常 + FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 您不能在空值表达式上调用方法。 在行:11 字符:1 + $response.RawContentStream.WriteTo($filestream) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
用户名和密码肯定是正确的,但还是会导致这个错误。
我应该如何更改这一行?
$response = Invoke-WebRequest -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method GET
【问题讨论】:
-
您使用的是 Kudu 的部署凭据,而不是您的 Azure 门户凭据,对吧?
标签: azure azure-powershell kudu