Powershell Azure Save-AzureWebsiteLog会因MaxReceivedMessageSize而引发错误

时间:2014-03-17 21:41:30

标签: azure azure-web-sites azure-powershell

我正在尝试使用powershell下载特定网站的网站日志:

Save-AzureWebsiteLog -Name website1 -output file.zip

它引发了一个关于最大邮件大小配额的错误,我已经搜索了一个答案,但我能找到的只是在服务器web.config上设置这个 - 这不是客户端的设置,因为它是请求回复的人吗?

save-azurewebsitelog : The maximum message size quota for incoming messages (65536) has been exceeded. To increase the
quota, use the MaxReceivedMessageSize property on the appropriate binding element.
At line:1 char:1
+ save-azurewebsitelog -name website1 -output file.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Save-AzureWebsiteLog], CommunicationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.SaveAzureWebsiteLogCommand

我问是否有人知道如何将此MaxRecievedMessageSize设置为高于65536的值,以便我可以下载我的IIS日志。

3 个答案:

答案 0 :(得分:4)

  1. 您可以在此处打开此问题:https://github.com/Azure/azure-powershell

  2. 同时您可以访问 scm 站点并通过浏览到以下网址下载IIS日志:https:// {siteName} .scm.azurewebsites.net(提供您的部署凭据)并单击顶部的诊断转储链接。

    有关此scm网站的更多信息,请访问:http://blogs.msdn.com/b/windowsazure/archive/2014/03/04/windows-azure-websites-online-tools-you-should-know-about.aspx

答案 1 :(得分:1)

我将此脚本作为解决方法: -

$username = "<enter git deployment username>"
$password = "<enter git deployment password>"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiUrl = "https://<website name>.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()
}

答案 2 :(得分:0)

This issue occurs when the log files exceed 65536, We will look at fixing this. in the meantime, please delete the OLD log files after downloading them, so you wont hit this issue.