mmajcica / DeploySsrs

Build-Release task for VSTS/TFS that manages Microsoft's SQL Server Reporting Services
MIT License
21 stars 21 forks source link

Deploy reports error: error downloading asmx file happening intermittently #83

Open thunt999 opened 1 year ago

thunt999 commented 1 year ago

deploying ssrs fails with "downloading asmx file" first run each day, immediate redeploy and it works . it would appear not to be permissions related as it works second time, so any ideas ?

mwhisler commented 1 year ago

I have the same issue. Lots of 503s too, but I get the intermittent asmx download quite often. This task is running against an Azure VM.

mwhisler commented 1 year ago

Could we try obtaining that proxy in a way that is more resilient to connection issues? I have been troubleshooting this issue for years and can't seem to find a solution other than a redeploy.

function Get-SSRSProxyWithRetries { param ( [Parameter(Mandatory=$true)] [string]$Url, [Parameter(Mandatory=$true)] [string]$AuthScheme, [string]$Username, [string]$Password, [int]$RetryCount = 3, [int]$RetryDelaySeconds = 5 )

$proxy = $null

for ($retry = 1; $retry -le $RetryCount; $retry++)
{
    try
    {
        if ($AuthScheme -eq "windowsAuthentication")
        {
            $proxy = New-WebServiceProxy -Uri $Url -Namespace SSRS.ReportingService2010 -UseDefaultCredential -Class "SSRS"
        }
        else
        {
            $securePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
            $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $securePassword

            $proxy = New-WebServiceProxy -Uri $Url -Namespace SSRS.ReportingService2010 -Credential $credential -Class "SSRS"
        }

        # Connection succeeded, break out of the retry loop
        break
    }
    catch
    {
        Write-Host "Failed to connect to the SSRS server. Retrying in $RetryDelaySeconds seconds..."
        Start-Sleep -Seconds $RetryDelaySeconds
    }
}

if (-not $proxy)
{
    throw "Failed to establish a connection to the SSRS server after $RetryCount retries."
}

return $proxy

}

mmajcica commented 1 year ago

Gents, I have no time/resources to support this. In case you have improvements/fixes, you would like to share, I would be more than happy to merge a PR and publish a new version or assist you in any other way.

Cheers